Structures and Linked Lists Flashcards
What is a structure?
A structure is a type of variable that groups multiple related data items together.
Which Compiler Directive is used to shorten the definition of a struct?
typedef
What does a node in a linked list contain?
It consists of data and one or more links to other nodes that record the sequence of the nodes
What are the two advantages of a linked list?
It is memory efficient when storing large data structures, and speed efficient at inserting and deleting nodes.
What is the advantage of a standard array?
Allows direct access to all items in the array.
What is the disadvantage of a standard array?
Insert and delete operations require additional operations due to needing to move around or copy other elements into memory.
What are the advantages of a dynamically linked list?
It doesn’t matter where the nodes are stored, insert/delete operations only change 1 or 2 values, the size of the list is limited only by computer memory, one list may be linked in more than one way.
What is the disadvantage of a dynamically linked list?
To find an element you must go from the start node and follow the pointers until the correct item is found.