Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please add these 4 methods to the Java class below, if you can't add 4 then pls add at least 2 or 3. package rbk;

Please add these 4 methods to the Java class below, if you can't add 4 then pls add at least 2 or 3. image text in transcribed 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; } }

* 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 st. first element of 1 * 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 st. first element of 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

=+ What is the role of government in bargaining?

Answered: 1 week ago

Question

=+ Who is the negotiation partner at company level?

Answered: 1 week ago