Skip Lists

212,700pages on
this wiki
Add New Page
Add New Page Discuss this page0

Skip lists are one of the most powerful data structures in DXL. They are dynamic, so you can just keep throwing stuff in there. They are very quick when both adding and removing items. They are however very slow when creating or deleting specific instances.

Adding stuff

Anything can be put into a Skip list. They do not have a type, however if an object is stored in a skip list as one type, and pulled out as another, you will get a access denied error.


The following is the signature of the put method, which adds the specified key and value to the skip list.

bool put(Skip, key, value)

This function returns whether or not it was successful in adding the specified pair to the list.

Getting stuff back

Unfortunately there is not "get" function for Skip lists. The easiest way to get something out of a skip list is to do a for loop. The following example takes all of the selected objects in a module, puts them in the list, then prints their object text.

Skip list = create
Object o
for o in current Module do
  if( isSelected(o) )
    put(list, o, o)
for o in list do
  print o."Object Text"
delete list

Memory Vs. Speed

You will notice in my last example I deleted the skip list at the end of the program, and that I had to create it in a special way in the beginning.

There are two important concepts about creating and deleting Skip lists. First, if you don't delete a skip list it remains in memory, even if you no longer have access to it. This means if you create skip lists in a for loop, and never delete them, each one in turn is left sitting in memory forgotten until you close the script.

The second is that deleting and creating skip lists is expensive in terms of time. Creating and deleting a skip list inside of a loop that will run multiple times will kill your performance. Even on a small script this can create a significant delay. On a large one it can add hours to execution time.

Also on Fandom

Random wikia