![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2006
Posts: 1
Rep Power: 0
![]() |
some one help
can some one write this program in java for me
The goal of this programming assignment is to study details of implementations of an example of dynamic dictionary: Skip-lists. The purpose of this programming assignment is to implement a class SkipList that supports basic operations on skip-lists. For simplicity, you may assume that all nodes in the lists will store numbers of type int. Multiple items with the same key should be allowed. Since to implement a list you will need a list structure that needs “nodes,” you also should implement a class node. (Your Skip-list should allow lists with up to N = 1000000 keys.) Functions used in the class SkipList: 1. create: creates an empty Skip-list. 2. isEmpty: returns true if and only if the Skip-list is empty. 3. size: returns the size of the Skip-list, that is, the number of elements in the Skip-list. 4. search(key): returns TRUE if there is an element with key key in the Skip-list; if there is none, then it returns FALSE. 5. insert(key): inserts into the Skip-list a new element with the key key. 6. delete(key): deletes from the Skip-list an element with the key key; if no such an element is stored in the Skip-list, then no change to the data structure should be done; if more than one elements with given key is in the Skip-list, then only one (any) of these elements should be deleted. (Note for C++ programmers: since delete is a restricted keyword in C++¡ you are allowed to rename this function to remove(key). However, if you do so, you must explicitly state this in the comments before your program!) 7. display: displays the Skip-list on the standard output. The format in which the Skip-list should be displayed is as follows: • the first line contains the number of lists in the Skip-list (using the terminology from the textbook, if the lists are denoted by S0, S1, . . . , Sh, then the number should be equal to h + 1) • the next h + 1 lines: 2 ⊲⊳ the ith line contains the list Si in the Skip-list in the following format: ◮ number i (where i is the number of the list) followed by the colon (punctuation mark ![]() ◮ number of elements in the list (not including −∞and∞) followed by the colon ◮ the keys of the elements from the ith list separated by commas ◮ the line should terminate with a dot (.). For example, the Skip-list from Figure 3.46 from the textbook should be displayed as follows: 6 0: 10: 12, 17, 20, 25, 31, 38, 39, 44, 50, 55. 1: 7: 12, 17, 25, 31, 38, 44, 55. 2: 4: 17, 25, 31, 55. 3: 3: 17, 25, 55. 4: 1: 17. 5: 0:. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
So what work do u have so far?
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
#3 | |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|