Question: Please help in this java code. ------------------------------------------------------------------------------------------------------------------------------------------------- // Starter code skip lists package rbk; import java.util.Iterator; public class SkipList > { static final int PossibleLevels

Please help in this java code.

Please help in this java code. ------------------------------------------------------------------------------------------------------------------------------------------------- // Starter code skip lists

-------------------------------------------------------------------------------------------------------------------------------------------------

// Starter code skip lists package rbk; import java.util.Iterator; public class SkipList> { static final int PossibleLevels = 33; static class Entry { E element; Entry[] next; Entry prev; public Entry(E x, int lev) { element = x; next = new Entry[lev]; // add more code as needed } public E getElement() { return element; } } // Constructor public SkipList() { } // Add x to list. If x already exists, reject it. Returns true if new node is added to list public boolean add(T x) { return true; } // Find smallest element that is greater or equal to x public T ceiling(T x) { return null; } // Does list contain x? public boolean contains(T x) { return false; } // Return first element of list public T first() { return null; } // Find largest element that is less than or equal to x public T floor(T x) { return null; } // Return element at index n of list. First element is at index 0. public T get(int n) { return null; } // Is the list empty? public boolean isEmpty() { return false; } // Iterate through the elements of list in sorted order public Iterator iterator() { return null; } // Return last element of list public T last() { return null; } // Remove x from list. Removed element is returned. Return null if x not in list public T remove(T x) { return null; } // Return the number of elements in the list public int size() { return 0; } }

Implement the following operations of skip lists, following the algorithms discussed in class. starter code is provided. A driver program is also provided Sample inputs and outputs will be provided Do not change the signatures of methods declared to be public. You can add additional fields, nested classes, and methods as needed. Do not create additional source files. Place all code in skipList.java * add(x): Add a new element x to the list. If x already exists in the skip list, replace it and return false. otherwise, insert x into the skip list and return true. * ceiling(x): Find smallest element that is greater or equal to x. contains (x): Does list contain x? first): Return first element of list. * floor(x): Find largest element that is less than or equal to x. *get(n): Return element at index n of list. First element is at index * isEmpty(): Is the list empty? *iterator(): Iterator for going through the elements of list in sorted order * last(): Return last element of list. remove(x): Remove x from the list. If successful, removed element is returned. otherwise, return null. * size(): Return the number of elements in the list. Implement the following operations of skip lists, following the algorithms discussed in class. starter code is provided. A driver program is also provided Sample inputs and outputs will be provided Do not change the signatures of methods declared to be public. You can add additional fields, nested classes, and methods as needed. Do not create additional source files. Place all code in skipList.java * add(x): Add a new element x to the list. If x already exists in the skip list, replace it and return false. otherwise, insert x into the skip list and return true. * ceiling(x): Find smallest element that is greater or equal to x. contains (x): Does list contain x? first): Return first element of list. * floor(x): Find largest element that is less than or equal to x. *get(n): Return element at index n of list. First element is at index * isEmpty(): Is the list empty? *iterator(): Iterator for going through the elements of list in sorted order * last(): Return last element of list. remove(x): Remove x from the list. If successful, removed element is returned. otherwise, return null. * size(): Return the number of elements in the list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!