This week we concentrated on linked lists. This means that the linked list is exactly the size needed for the input data. An array has static array bounds which means the array is usually either too large or not large enough. In the case of not large enough, the array size must be changed and the program must be re-compiled. Easier to delete an item out of a linked list since can drop the item out of the list, whereas the array requires either sliding up the items below or figuring out a scheme that deleted items remain in the list and are some how skipped when printed even though they remain in the list.
Linked lists are slower to access than an array.
Linked lists require additional memory for the link element of the linked list whereas an array requires only the memory location for each element. Linked lists are more error prone and are harder to write than code for an array. The following is code that we wrote for implementing a stack. It implements this using a singley linked list. December 1, 2000.