1. Engineering
  2. Computer Science
  3. need c format need skiplistnodeh amp cpp and maincpp ...

Question: need c format need skiplistnodeh amp cpp and maincpp ...

Question details

need c++ format

need SkipListNode.h & .cpp and main.cpp

**********************************************************

1.3 The Skip Lists Node Class Each node of a skip list must be capable of pointing to multiple sucessors in the skip list structure. This could be accomplished with an array of pointers of fixed size, but this is wasteful in terms of storage since the size would have to be large enough to accommodate the biggest possible skip list. It is more efficient to the skip list itself just prior to the creation of the node. The number of next pointers can be passed to the skip list node constructor along with the value to be stored. Note that the pointer access methods must y allocate an array of pointers for the node based on information which can be determined by specify one of the next pointers; the number of pointers in the nodes array should be stored so that the access methods can verify legitimate requests1.3.1 Displaying the Skip List Node From a purely object-oriented standpoint, the only piece of human-readable information in a skip list node is the data stored there; the next pointers are essentially random numbers which most likely change from execution to execution of the program. From a program development point of view, however, it will be helpful to be able to visually confirm the next pointer contents. To do so, the write method for one node shall parenthetically display the values (and only the values) of successor nodes in addition to its own value. // write nodes key value for // each next pointer if // nexts[i] leads to a node // write (nodes key value) else // write Add the interface and implementation of write to the project and overload the << operator so that it invokes method write. Test it with the following program segment in function main SkipListNode n1 (103, 3); SkipListNode n2 (201, 1); cout << w/o setNext: << n1 << endl << n1.setNext (0, &n2); cout << setNext: << n1 << endl << << n2 << endl; << n2 << endl; The results should appear as follows w/o setNext: 201 ( /) 103 201) (( /) 201 /) setNext:

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution