+ 37
Can address tuples like arrays?
3 odpowiedzi
+ 23
Like question of this lesson
Logic(0,1)
+ 24
Array: contiguous in memory (so each element is one after the other). fixed sized. very space efficient. very efficient to iterate over and access random elements. not efficient to insert something new in the middle of it, or to delete something. dynamic arrays (vectors, arraylist, etc) can be efficiently resized, and are the preferred data structure for lists unless you have a reason not to use them.
(Linked) list: not continuous in memory. each node of the list contains data and a pointer/reference to the next element (and maybe a pointer to the previous). fairly efficient to iterate over. inefficient to access a random element, but efficient to access to first (and maybe last) element, efficient to add an element after (and maybe before) another, or remove an element. very efficient to merge and splice.
tuple: completely different. tuples (or product types) do not represent a list of data. They are an object with a fixed dimension and each coordinate contains a particular type of data (in linked lists and
+ 23
Let logic(0,1)