A skip list is a data structure that allows Oflog n) search complexity as well as O(log n)insertion complexity within an ordered sequence of n elements. A skip list is built in layers. Each layer is...
A skip list is a data structure that allows Oflog n) search complexity as well as O(log n)insertion complexity within an ordered sequence of n elements. A skip list is built in layers. Each layer is a linked list. The bottom layer is an ordinary ordered linked list. Each higher layer acts as an "express lane" for the lists below, where an element in layer L appears in layer L+1 (higher layer) with some fixed probability p. A search for a target element begins at the head element in the top list, and proceeds horizontally until the current element is greater than or equal to the target. If the current element is equal to the target, it has been found. If the current element is greater than the target, or the search reaches the end of the linked list, the procedure is repeated after returning to the previous element and dropping down vertically to the next lower list. NIL NIL NIL NIL head 1 2 3 4567 8 910 For the skip list above, what numbers will be visited when searching for 52 (do not include NIL and the numbers larger than the target number) Select one: 。a. 1,2,3,4,5 b. None of them d. 1,3,4,5
A skip list is a data structure that allows Oflog n) search complexity as well as O(log n)insertion complexity within an ordered sequence of n elements. A skip list is built in layers. Each layer is a linked list. The bottom layer is an ordinary ordered linked list. Each higher layer acts as an "express lane" for the lists below, where an element in layer L appears in layer L+1 (higher layer) with some fixed probability p. A search for a target element begins at the head element in the top list, and proceeds horizontally until the current element is greater than or equal to the target. If the current element is equal to the target, it has been found. If the current element is greater than the target, or the search reaches the end of the linked list, the procedure is repeated after returning to the previous element and dropping down vertically to the next lower list. NIL NIL NIL NIL head 1 2 3 4567 8 910 For the skip list above, what numbers will be visited when searching for 52 (do not include NIL and the numbers larger than the target number) Select one: 。a. 1,2,3,4,5 b. None of them d. 1,3,4,5