Drawing consisting of two linked lists with pointers and values

China☆狼群 提交于 2019-12-13 03:54:59

问题


I just started taking an algorithms course, however, due to some family issues, I did not have a chance to participate in the first two lectures. Now I'm in a bit of a pickle, because I don't understand much of what is going on.

Above is a picture of a task that I need to solve. From what i understand, L0 is a list containing all values of S and L1 is a list containing all values of S and a pointer to the corresponding value in L0. However, what I do not understand is when they start bringing in delta and drawings. If anyone could clarify the meaning of delta and the parameter delta = 3, I might have a chance of solving it.

Any help is appreciated.


回答1:


Here, 'delta' is just a parameter. You can call it 'd' if you prefer.

L0 contains all elements of S (as a linked list). L1 contains every 'delta'th element of S as a linked list, with a pointer to the corresponding value in L0.

So the answer to 2.1 is something like:

L0: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8
    ^              ^              ^
    |              |              |
L1: 1 -----------> 4 -----------> 7

That is, L1 contains the 0th, 3rd, and 6th (i=0, delta, 2*delta, where delta=3) element of S.



来源:https://stackoverflow.com/questions/55088731/drawing-consisting-of-two-linked-lists-with-pointers-and-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!