mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-03 10:35:34 +08:00
skip-list documentation-polish
This commit is contained in:
@@ -54,7 +54,10 @@ public:
|
||||
void deleteElement(int);
|
||||
void* searchElement(int);
|
||||
void displayList();
|
||||
~SkipList();
|
||||
};
|
||||
|
||||
|
||||
|
||||
SkipList::SkipList() {
|
||||
level = 0;
|
||||
@@ -63,6 +66,18 @@ SkipList::SkipList() {
|
||||
}
|
||||
|
||||
|
||||
SkipList::~SkipList(){
|
||||
delete header;
|
||||
for(int i=0; i <= level; i++) {
|
||||
Node *node = header->forward[i];
|
||||
Node* temp;
|
||||
while(node != NULL) {
|
||||
temp = node;
|
||||
node = node->forward[i];
|
||||
delete temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user