WEEK 5: LINKED LIST Flashcards
(19 cards)
3 types of linked list
singly linked list, doubly linked list, circular linked list
2 limitations of arrays which make inserting an item inside an array difficult
- size has to be known at compliation
- data in the array are separated in the computers memory by the same distance
this can be used to get around the limitations of arrays by linking data independently from where it is stored in the computer’s memory
linked list
to create a linked list, each piece of data in the set of data simply has to also store the _______ of the next piece of data in the set
address
this is a collection of nodes storing data and links to other nodes
linked list / linked structure
nodes can be located anywhere in the memory, and passing from one node of the linked structure to another is accomplished by __________________________
storing the address of other nodes in the linked structure
a data structure that makes it easy to rearrange data without having to mode cata in memory
linked list
in the real world, this plays a critical role in applications that help companies and governments manage data dynamically
linked list
this enables a program to move through the list in one direction, which is usually from the front of the list moving to the end of it
singly linked list
this enables a program to move through a list in both directions
doubly linked list
true or false: programmers choose arrays over linked lists because arrays can grow and shrink in size during runtime
false
process for changing the size of an array
an operating system changes the size of an array by finding another location large enough to hold elemends of the array anf new array elements, then the existing elements of the array are copied onto the new location
process of changing the size of a linked list
the operating system changes references to the previous item and the next item on the list
each entry in a linked list
node
parts of a node in a singly linked list
data, pointer to the next node
parts of a node in a doubly linked list
data, pointer to the next node, pointer to the previous node
main difference between normal linked list and circularly linked list
normal linked list - last node pointer is addressed to NULL
circularly linked list - last node pointer is addressed to first node
how to create a linked list
- initialize a structure using struct keyword and delcare variables for data and pointers
- initialize head to point to the first node of the linked list
steps to insert a new node to a linked list
- allocate memory for the new node
- point new node to its successor
- point the new node’s predecessor to the new node