We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e2cf889 commit 16bb0d5Copy full SHA for 16bb0d5
1 file changed
Sprint-2/implement_skip_list/skip_list.py
@@ -43,7 +43,10 @@ def _find_position(self, value):
43
b = self.skips[i + 1]
44
45
node_a = self._get_node(a)
46
- node_b = self._get_node(b)
+ node_b = node_a
47
+ for _ in range(b - a):
48
+ if node_b:
49
+ node_b = node_b.next
50
51
if node_a.value <= value < node_b.value:
52
# linear search between a and b
@@ -95,7 +98,10 @@ def __contains__(self, value):
95
98
96
99
97
100
101
102
103
104
105
106
107
idx = a
0 commit comments