Search in a skip list at O(logk)

  • Thread starter Thread starter Edd257
  • Start date Start date
  • Tags Tags
    List Search
AI Thread Summary
To achieve O(logk) expected running time for searching an element x in a skip list, one approach involves leveraging the structure of the skip list to skip over elements efficiently. Instead of a linear search, the algorithm should utilize the hierarchical levels of the skip list to narrow down the search space based on the position of x. A reasonable upper bound for k can be determined by analyzing the distribution of elements and their levels in the skip list. Pseudocode should focus on traversing the list by jumping through levels while maintaining a count of elements to ensure the search remains efficient. Implementing this strategy will allow for the desired search time complexity.
Edd257
Messages
5
Reaction score
0
I need to write a code that finds element x in a skip list. I need to implement that in O(logk) expected running time, where k is the location of x at the list (i.e., there are k-1 elements before x in the list).

I know how to do it at o(logn), but not o(logk).

can you show me the way? I need only general description or pseudo code, not more than that.
 
Physics news on Phys.org
Can you find a "reasonable"* upper bound on the position of your element that runs in O(logk)?

*n is a trivial upper bound of course and does not help, the only non-trivial way I see is reasonable.
 

Similar threads

Back
Top