Menu

Skip List Java Follow Following Instructions Implement Class Nodeskiplist Two Components N Q43828187

Skip list in Java:

You can follow the following instructions:

– Implement the class NodeSkipList with two components, namelykey node and array of successors. You can also add a constructor,but you do not need to add any method.

– In the class SkipList implement a constructor SkipList(longmaxNodes). The parameter maxNodes determines the maximal number ofnodes that can be added to a skip list. Using this parameter we candetermine the maximal height of a node, that is, the maximal lengthof the array of successors. As the maximal height of a node it isusually taken the logarithm of the parameter. Further, it is usefulto construct both sentinels of maximal height.

– In the class SkipList it is useful to write a method whichsimulates coin flip and returns the number of all tosses until thefirst head comes up. This number represents the height of a node tobe inserted.

2 – In the class SkipList implement the following methods:

(i) insert, which accepts an integer and inserts it into a skiplist. The method returns true, if the element is successfullyinserted and false, if the element already exists in the datastructure.

(ii) search, which accepts an integer and finds it in a skiplist. The method returns true, if the element is successfully foundand false otherwise.

(iii) delete, which accepts an integer and deletes it from askip list. The method returns true, if the element is successfullydeleted and false otherwise.

Expert Answer


Answer to Skip list in Java: You can follow the following instructions: – Implement the class NodeSkipList with two components, na…

OR