A python script to visualize a skiplist based off of the value of the node and its height. This program currently only supports skiplists that implement the SSet interface (It automatically sorts the nodes so it will not work if you wish to draw an unsorted skiplist)
Open a terminal. In the terminal, navigate into the folder containing the skiplist.py file. You can do this using the following command:
cd <path to skiplist.py file>Once you are in that directory, you may create the skiplist in 1 of 2 ways:
-
The manual way: In your terminal, enter the command:
python skiplist.py
The program will continuously prompt you for a node value and then a corresponding height. To exit, enter the word "quit" instead of the node value. The script will output a neat visualization of the skiplist to the terminal.
-
The automatic way: Create a new txt file. Open the txt file and, in order, write the node value, then on the next line, the node height. Repeat this until you have all your desired nodes and their attributes written down. Once you are done, create a last line and write the word "quit" in it. In your terminal, enter the command:
python skiplist.py < [txtFileName.txt]The script will automatically read the values from the text file and output a neat visualization of the skiplist to the terminal.