The purpose of this exercise is to understand in detail the mechanics
of insertion and removal of elements from skiplists.
Work on this exercise by yourself.
This is an extra credit assignment.
Create a new project called SkipList. Have an inner class
called Node
Use parameterized generics.
Implement public boolean insert(T e) and public
boolean remove(T e) methods.
The head node is to have a size of 21. This is the maximum size of
any node in the skiplist.
For testing purposes, implement a public boolean insert(T
e, int size) method which creates a node with element "e" and an
ArrayList of pointers to the next node that is of size "size". Notice
that the regular method uses a random generator to determine the size
of a node.
Calling insert as follows, results in the SkipList shown below:
Node class: For testing purposes, have a method getLinks() which
returns an arraylist. Calling this method on a node returns the links
of the node.
Node class: For testing purposes, have a method getElement() which
returns the element at that node.
Skiplist class: For testing purposes, make the root element of the
Skiplist class public.
Use the following unit test cases as
well as additional test cases of your own choosing to develop and
debug your software. In particular, it may be helpful to have a
toString() method which enables you to visualize the nodes and their
links.
Please submit your SkipList.java file to the appropriate drop-box
on Moodle.