mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
update
This commit is contained in:
parent
2fecf67a36
commit
a707d710b5
@ -26,12 +26,9 @@ using std::endl;
|
|||||||
* Node structure [Key][Node*, Node*...]
|
* Node structure [Key][Node*, Node*...]
|
||||||
*/
|
*/
|
||||||
struct Node {
|
struct Node {
|
||||||
int key;
|
int key; ///< key integer
|
||||||
// pointer of value
|
void* value; ///< pointer of value
|
||||||
void* value;
|
vector<Node*> forward; ///< nodes of the given one in all levels
|
||||||
// Forward Array points to the neighbour (right)
|
|
||||||
// nodes of the given one in all levels
|
|
||||||
vector<Node*> forward;
|
|
||||||
// Constructor of the node
|
// Constructor of the node
|
||||||
Node(int key, int level, void* value);
|
Node(int key, int level, void* value);
|
||||||
};
|
};
|
||||||
@ -54,10 +51,8 @@ Node::Node(int key, int level, void* value) {
|
|||||||
* SkipList class implementation with basic methods
|
* SkipList class implementation with basic methods
|
||||||
*/
|
*/
|
||||||
class SkipList {
|
class SkipList {
|
||||||
// Maximum level of the skiplist
|
int level; ///< Maximum level of the skiplist
|
||||||
int level;
|
Node *header; ///< Pointer to the header node
|
||||||
// Pointer to the header node
|
|
||||||
Node *header;
|
|
||||||
public:
|
public:
|
||||||
SkipList();
|
SkipList();
|
||||||
int randomLevel();
|
int randomLevel();
|
||||||
|
Loading…
Reference in New Issue
Block a user