s*******e 发帖数: 174 | 1 这个 skip list 和 LinkedList 不同的是多了一个 skip which points to a random
element.
Class Element
{
int value;
Element next;
Element skip;
}
Implement the method to search value in the skip list, 很多方法都可以行的通
,要求给出最优方法。。
public Element searchValue(Element head, int val)
{
} |
h*****0 发帖数: 4889 | 2 value排列有规律吗?感觉没有规律肯定只能顺序查找了。
random
【在 s*******e 的大作中提到】 : 这个 skip list 和 LinkedList 不同的是多了一个 skip which points to a random : element. : Class Element : { : int value; : Element next; : Element skip; : } : Implement the method to search value in the skip list, 很多方法都可以行的通 : ,要求给出最优方法。。
|
s*******e 发帖数: 174 | 3 这个我也很困惑,面试官没说是 sorted list, 我也忘了问
【在 h*****0 的大作中提到】 : value排列有规律吗?感觉没有规律肯定只能顺序查找了。 : : random
|
m******t 发帖数: 2416 | 4 Just treat it as a graph and do breadth first search?
random
【在 s*******e 的大作中提到】 : 这个 skip list 和 LinkedList 不同的是多了一个 skip which points to a random : element. : Class Element : { : int value; : Element next; : Element skip; : } : Implement the method to search value in the skip list, 很多方法都可以行的通 : ,要求给出最优方法。。
|