Skip to content
Search Algorithm
step 1/5

Reading — step 1 of 5

Read

~1 min readInsert & Search

Search Algorithm

python

Walk top-down: at each level, advance forward while the next key is still < target. When you can't advance, drop a level. After level 0, check if the next node is the target.

Average case: at each level, advance ~constant steps before dropping. Total levels: log_2(n). Total steps: O(log n).

Worst case (degenerate flips): O(n). With proper random levels, this is exceedingly rare — the probability is ~1/n.

Compare to balanced BSTs (red-black, AVL): same O(log n) but skip lists are simpler to make concurrent. RB trees require complex rotations; skip lists just relink forward pointers.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…