July 2015
Intermediate to advanced
380 pages
10h 15m
English
This is an array that grows on its own and has most of the same features as a linked list. It will usually take up less space, run faster, and has other beneficial properties. This exercise will cover a few of the disadvantages, like very slow removal from the front, with a solution to just do it at the end.
A dynamic array is simply an array of void ** pointers that’s pre-allocated in one shot and that point at the data. In the linked list, you had a full structure that stored the void *value pointer, but in a dynamic array, there’s just a single array with all of them. This means you don’t need any other pointers for next and previous records since you can just index into the dynamic array directly.
To start, I’ll ...