



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Definitions and comparisons of various list and stack data structures, including array-based list, linked list, single linked list, dynamic array, freelists, doubly linked lists, and stack implementations. It covers concepts such as length, head, tail, convenience methods, overhead, and time comparison.
Typology: Quizzes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




A finite ordered sequence of elements, similar to mathematical sequence. Ordered simply means that an element has a given position in the list not that the list is sorted. TERM 2
DEFINITION 2 Number of elements currently stored TERM 3
DEFINITION 3 beginning node to list TERM 4
DEFINITION 4 End or last element of the list. TERM 5
DEFINITION 5 A method that is implemented by means of other member functions in the same asymptotic time.
Get value at element - O(1)Insert - O(n) in average caseAppendRemove - O(n) in average case TERM 7
DEFINITION 7 requires dynamic memory allocation for each node TERM 8
DEFINITION 8 Requires a field for the object stored and a pointer to the next node, and for a doubly-linked list a pointer to the previous node. Or instead of using pointers you could have theactual nodes as fields. TERM 9
DEFINITION 9 Insert - O(1)Insert to i position - O(n) on averageremove - O(1)Remove element at position i - O(n) on average caseGet position i - O(i), O(n) on averageNext - O(1)Previous - O(n - i - 1), O(n) on average TERM 10
DEFINITION 10 Additional memory space required by a structure for data to be organized or stored. Array has overhead when using it to implement the List structure because the size of the array must be allocated for the elements to be entered. The LList has overhead because it needs the next pointer field.
All objects stored in a structure are of the same type TERM 17
DEFINITION 17 list structure where objects are inserted and removed only from one end and works in LIFO (Last in first out). The accessible element is the top, where objects are pushed on and popped off. TERM 18
DEFINITION 18 Have the "top" of the stack be the end (position n-1), for their implementation they used the top at position n so it was the first empty element on the stack.This has the same draw backs as the array list implementation except the shifting of elements to maintain contiguous memory space. TERM 19
DEFINITION 19 An example is the freelist, elements are inserted and removed only at the end just like the array implementation. This does not require a head sentry node, the first element or the head of the linked list is the top of the stack. TERM 20
DEFINITION 20 Neither is more time efficient, but you still have the overhead problem with both so you would analyze the situation similar to with a list, but the array provides an interesting implementation of two stacks that grow inversely where you can start the stacks at opposite ends of the array growing inwards towards eachother.
Information pushed onto the stack for subroutine calls. TERM 22
DEFINITION 22 hmmmmmm, well then.Apparently because calling a function recursively is relatively expensive it is better to use iteration, but that makes ugly code (supposedly but I think recursion is difficult to understand when reading someone else's code) and sometimes it cannot be done using iteration.....although i thought it could, but apparently not. TERM 23
DEFINITION 23 list like structure, insertion occurs at the back called enqueue and removed from the front called dequeue, like a lunch line. A queue is a FIFO list unlike the stack which is a LIFO. TERM 24
DEFINITION 24 The implementation is tricky there are weird special cases. This is handled by letting the front and rear elements change position with the data instead of being fixed to the front of the array. You treat the array like a circle where the highest element connects to the lowest, you use mod operator