LIBKYDATASTRUCT(3)

NAME
libkydatastruct - 时间复杂度: 插入（平均）: O(log(n)) 删除（平均）: O(log(n)) 查找（平均）: O(log(n)) 空间复杂度: O(n)

SYNOPSIS

  Typedefs
typedef struct _kysdk_skiplist_node kysdk_skiplist_node typedef struct _kysdk_skiplist_node {
    int key;
    kysdk_listdata data;
    struct _kysdk_skiplist_node **next;
} kysdk_skiplist_node;
typedef struct _kysdk_skiplist kysdk_skiplist typedef struct _kysdk_skiplist {
    unsigned int counts; // 节点个数
    unsigned int max_levels; // 最高层数
    kysdk_skiplist_node **children;
} kysdk_skiplist;

  Functions
kysdk_skiplist * kysdk_create_skiplist ()
创建跳表
void kysdk_destroy_skiplist (kysdk_skiplist *list)
销毁跳表，并回收所有分配的内存；注意data.ptr指向的内存（若存在）不会被释放
int kysdk_skiplist_setmaxlevels (kysdk_skiplist *list, unsigned int maxlevels)
设置跳表最高层数，该选项必须在跳表为空时使用
int kysdk_skiplist_insert (kysdk_skiplist *list, int key, kysdk_listdata data)
插入节点
int kysdk_skiplist_delete (kysdk_skiplist *list, int key)
删除key值对应的节点
kysdk_listdata kysdk_skiplist_search (kysdk_skiplist *list, int key)
根据给定的key搜索data内容

Detailed Description

时间复杂度: 插入（平均）: O(log(n)) 删除（平均）: O(log(n)) 查找（平均）: O(log(n)) 空间复杂度: O(n)

CONFORMING TO
These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kysdk_create_skiplist(), kysdk_destroy_skiplist(), kysdk_skiplist_setmaxlevels(), kysdk_skiplist_insert(), kysdk_skiplist_delete() and kysdk_skiplist_search().

SEE ALSO
kysdk_create_skiplist(3), kysdk_destroy_skiplist(3), kysdk_skiplist_setmaxlevels(3), kysdk_skiplist_insert(3), kysdk_skiplist_delete(3) and kysdk_skiplist_search(3).

Author

Generated automatically by Doxygen for skip_linklist.h from the source code.