由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 那个skiplist的题谁来给谢谢
相关主题
问个reverse linked list请教一个二叉树镜像问题
leetcode过的一代工程师请教一道面试题
delete a node in linked list刚刚电面bloomberg,被问到一个没看到过的问题
ms面试题目分享:non-recursive breadth first search and depth first search algorithm in C
binary tree的in-order iterator怎么写?phone interview program with a small startup
Print a binary tree in level order but starting from leaf node up to root合并两个排序好的链表, 优解?
几道F家面试题一道面试题:Flatten a multilevel linked list
一道面试题G家intern电面新鲜面经
相关话题的讨论汇总
话题: skip话题: pcur话题: nindex话题: node话题: skiplist
进入JobHunting版参与讨论
1 (共1页)
a*******y
发帖数: 1040
1
写code实现struct skip_list * find(struct skip_list *head, int value)
还有这个struct怎么定义?
l*****a
发帖数: 14598
2
这个算法课教吗?

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

h********6
发帖数: 285
3
题目是啥?

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

w****x
发帖数: 2483
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;
}
p*****2
发帖数: 21240
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)
: {

1 (共1页)
进入JobHunting版参与讨论
相关主题
G家intern电面新鲜面经binary tree的in-order iterator怎么写?
感觉今天结结实实被烙印阴了Print a binary tree in level order but starting from leaf node up to root
Find LeastCommonAncestor for N-ary Tree几道F家面试题
一道老题目, 求最快捷解法一道面试题
问个reverse linked list请教一个二叉树镜像问题
leetcode过的一代工程师请教一道面试题
delete a node in linked list刚刚电面bloomberg,被问到一个没看到过的问题
ms面试题目分享:non-recursive breadth first search and depth first search algorithm in C
相关话题的讨论汇总
话题: skip话题: pcur话题: nindex话题: node话题: skiplist