Redian新闻
>
那个skiplist的题谁来给谢谢
avatar
那个skiplist的题谁来给谢谢# JobHunting - 待字闺中
a*y
1
写code实现struct skip_list * find(struct skip_list *head, int value)
还有这个struct怎么定义?
avatar
l*a
2
这个算法课教吗?

【在 a*******y 的大作中提到】
: 写code实现struct skip_list * find(struct skip_list *head, int value)
: 还有这个struct怎么定义?

avatar
h*6
3
题目是啥?

【在 a*******y 的大作中提到】
: 写code实现struct skip_list * find(struct skip_list *head, int value)
: 还有这个struct怎么定义?

avatar
w*x
4
//How to find a value in a skip list
//about skip-list http://en.wikipedia.org/wiki/File:Skip_list.svg
struct SKIP_NODE
{
int nVal;
vector links;
};
//sort like binary search, scope down to decrease the searching range
SKIP_NODE* Find(SKIP_NODE* pHead, int x)
{
assert(pHead);
SKIP_NODE* pCur = pHead;
int nIndex = pHead->links.size() - 1;
while (nIndex >= 0)
{
if (pCur->nVal == x)
return pCur;
if (pCur->links[nIndex] == NULL ||
pCur->links[nIndex]->nVal > x)
nIndex--;
else
pCur = pCur->links[nIndex];
}
return NULL;
}
avatar
p*2
5

牛x,这个有时间得学习一下。上次有人提到跳表我一点也不懂。

【在 w****x 的大作中提到】
: //How to find a value in a skip list
: //about skip-list http://en.wikipedia.org/wiki/File:Skip_list.svg
: struct SKIP_NODE
: {
: int nVal;
: vector links;
: };
: //sort like binary search, scope down to decrease the searching range
: SKIP_NODE* Find(SKIP_NODE* pHead, int x)
: {

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。