A skip list The second programming homework is already on a server (http://marmoset.famnit.upr.si). In this task, a skip list data structure should be implemented. You can follow the following instructions: - Implement the class NodeSkipList with two components, namely key 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(long maxNodes). The parameter maxNodes determines the maximal number of nodes that can be added to a skip list. Using this parameter we can determine the maximal height of a node, that is, the maximal length of the array of successors. As the maximal height of a node it is usually taken the logarithm of the parameter. Further, it is useful to construct both sentinels of maximal height. - In the class SkipList it is useful to write a method which simulates coin flip and returns the number of all tosses until the first head comes up. This number represents the height of a node to be inserted. - In the class SkipList implement the following methods: (i) insert, which accepts an integer and inserts it into a skip list. The method returns true, if the element is successfully inserted and false, if the element already exists in the data structure. (ii) search, which accepts an integer and finds it in a skip list. The method returns true, if the element is successfully found and false otherwise. (iii) delete, which accepts an integer and deletes it from a skip list. The method returns true, if the element is successfully deleted and false otherwise. given code: package psa.naloga3; public class SkipList { private NodeSkipList head; /* * Tvoritelj sprejme kot parameter stevilo elementov, ki jih je sposoben obdelati */ public SkipList(long maxNodes) { } /* * Metoda sprejme stevilo in ga vstavi v preskocni seznam. Ce element ze * obstaja v podatkovni strukturi, vrne false. Metoda vrne true, ce je bil * element uspesno vstavljen in false sicer. */ public boolean insert(int searchKey) { throw new UnsupportedOperationException("To funkcijo morate implementirati"); } /* * Metoda sprejme stevilo in poisce element v preskocnem seznamu. Metoda * vrne true, ce je bil element uspesno najden v podatkovni strukturi, in * false sicer */ public boolean search(int searchKey) { throw new UnsupportedOperationException("To funkcijo morate implementirati"); } /* * Metoda sprejme stevilo in izbrise element iz preskocnega seznama. Metoda * vrne true, ce je bil element uspesno izbrisan iz podatkovne strukture, in * false sicer */ public boolean delete(int key) { throw new UnsupportedOperationException("To funkcijo morate implementirati"); } } //this is the code for SKipList and the node: package psa.naloga3; public class NodeSkipList { }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

A skip list
The second programming homework is already on a server (http://marmoset.famnit.upr.si).
In this task, a skip list data structure should be implemented. You can follow the following
instructions:
- Implement the class NodeSkipList with two components, namely key 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(long maxNodes). The parameter maxNodes determines the maximal number of nodes that can be added to a
skip list. Using this parameter we can determine the maximal height of a node, that
is, the maximal length of the array of successors. As the maximal height of a node
it is usually taken the logarithm of the parameter. Further, it is useful to construct
both sentinels of maximal height.
- In the class SkipList it is useful to write a method which simulates coin flip and
returns the number of all tosses until the first head comes up. This number represents
the height of a node to be inserted.
- In the class SkipList implement the following methods:
(i) insert, which accepts an integer and inserts it into a skip list. The method
returns true, if the element is successfully inserted and false, if the element
already exists in the data structure.
(ii) search, which accepts an integer and finds it in a skip list. The method returns
true, if the element is successfully found and false otherwise.
(iii) delete, which accepts an integer and deletes it from a skip list. The method
returns true, if the element is successfully deleted and false otherwise. 

given code:
package psa.naloga3;

public class SkipList {

private NodeSkipList head;

/*
* Tvoritelj sprejme kot parameter stevilo elementov, ki jih je sposoben obdelati
*/
public SkipList(long maxNodes) {

}

/*
* Metoda sprejme stevilo in ga vstavi v preskocni seznam. Ce element ze
* obstaja v podatkovni strukturi, vrne false. Metoda vrne true, ce je bil
* element uspesno vstavljen in false sicer.
*/
public boolean insert(int searchKey) {
throw new UnsupportedOperationException("To funkcijo morate implementirati");
}

/*
* Metoda sprejme stevilo in poisce element v preskocnem seznamu. Metoda
* vrne true, ce je bil element uspesno najden v podatkovni strukturi, in
* false sicer
*/
public boolean search(int searchKey) {
throw new UnsupportedOperationException("To funkcijo morate implementirati");
}

/*
* Metoda sprejme stevilo in izbrise element iz preskocnega seznama. Metoda
* vrne true, ce je bil element uspesno izbrisan iz podatkovne strukture, in
* false sicer
*/
public boolean delete(int key) {
throw new UnsupportedOperationException("To funkcijo morate implementirati");
}

//this is the code for SKipList and the node:
package psa.naloga3;

public class NodeSkipList {

}


Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education