Question about access to the list from the noobie functional programmer

This may be a silly and obvious question, but why are examples of list access algorithms implemented in linear time? I understand that most applications include jump lists, not random access to them, but what if you want to access a random access list?

+5
source share
2 answers

Because design lists are a linear structure. This is a canonical recursive data type defined as:

 data [a] = [] | a : [a]

, node, , .

, , .

. ( ) ( , ).

: - . , , .

+10

Haskell ; , , .

, . , Data.Array Data.IntMap.

+9

All Articles