Answer the question
In order to leave comments, you need to log in
How to implement this structure as two arrays: NAME and NEXT?
We were given tasks to prepare for the exam in the theory of algorithms.
He did everything perfectly, except for one task, which I don’t understand at all and I don’t remember that we did something like that. I looked through the entire training manual, where there are all the topics of my course, but I did not find it. Who studied, can you help with the assignment? Or at least indicate which topics to google, because I really went through everything I could, but it's useless.
Answer the question
In order to leave comments, you need to log in
For example, the
NAME[EL1, EL2, EL3, EL3, EL4, EL5]
second one is quite often done this way - a connectivity array that stores links of a linked list,
NEXT[3, 5, 2, TAIL, 4]
which means that the first element of the list has a name NAME[1] = EL1
and refers to, NEXT[1]=3
that is, to NAME[3]=EL3
(array indexing here starts from 1, not from zero because it is done in your example) Such a structure is quite compact and adds to the advantages of a linked list the advantage of a sequential array - direct access to elements.
In one array there are values, and in another the order is a[b[n]]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question