Can address tuples like arrays? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 37

Can address tuples like arrays?

23rd Jul 2019, 2:52 PM
Mehdi Eslami
Mehdi Eslami - avatar
3 Answers
+ 23
Like question of this lesson Logic(0,1)
23rd Jul 2019, 2:53 PM
Mehdi Eslami
Mehdi Eslami - avatar
+ 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
8th Nov 2019, 12:44 PM
Rapt[#Demure]
Rapt[#Demure] - avatar
+ 23
Let logic(0,1)
23rd Jul 2019, 2:55 PM
Mehdi Eslami
Mehdi Eslami - avatar