Skip list in java

I was looking at data structures in java under the topic Skip list, and I came across the following:

In the list of passes n nodesfor each kand isuch that 1 ≤ k ≤lg nand 1 ≤ i ≤ n/2k–1⎦ – 1, the node in the position 2k–1· ipoints to the node in the position 2k–1· ( i + 1). This means that every second node points to node two positions forward, every fourth node points to node four positions forward, etc., as shown in Figure 3.17a. This is achieved due to the different number of reference fields in the nodes in the list: Half of the nodes have only one reference field, one quarter of the nodes have two reference fields, one-eighth of the nodes have three reference fields, and therefore on. The number of reference fields indicates the level of each node, and the number of levels maxLevel = ⎣lg n⎦ + 1.

And the figure: A list of passes with (a) uniformly and (b) unevenly distributed nodes of different levels; (c) a skip list with reference nodes is clearly indicated.

enter image description here

I don’t understand the mathematical part and what is the list of sktip and even nodes?

+5
source share
1 answer

Ok, let me try to make you understand this.

The skip list is a data structure that definitely speeds up the search in the list of predefined items.

The best analogy would be a metro network in any of the major cities. Imagine that you need to cover 90 stations, and there are different lines (green, yellow and blue).

The green line connects only stations with numbers 0, 30, 60, and 90. The yellow line connects 0, 10, 20, 30, 40, 50, 60, 70, 80, and 90 The blue line connects all stations from 0 to 90.

0 75. ?

0 60. 60 70. 70 75.

.

, - ( ).

, , 75.

, , Skip Lists .

75 75 . logN 1 + 1 + 15 . , , :)

: & , . . .

, Skip Lists.

( ), . , ( ) 2. (PS: 1 ). , .

. , ( ) ( ).

:) , , , , . , , , , .

, , , , . :)

, .

Diagram of Blue, Yellow, Green trains, and route taking Blue train from 0 to 60, Yellow train from 60 to 70, and finally Blue train from 70 to 71, 72, 73, 74, and 75.

+7

Source: https://habr.com/ru/post/1540538/


All Articles