WEEK 5: LINKED LIST Flashcards

(19 cards)

1
Q

3 types of linked list

A

singly linked list, doubly linked list, circular linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

2 limitations of arrays which make inserting an item inside an array difficult

A
  • size has to be known at compliation
  • data in the array are separated in the computers memory by the same distance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

this is a collection of nodes storing data and links to other nodes

A

linked list / linked structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

nodes can be located anywhere in the memory, and passing from one node of the linked structure to another is accomplished by __________________________

A

storing the address of other nodes in the linked structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

a data structure that makes it easy to rearrange data without having to mode cata in memory

A

linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

in the real world, this plays a critical role in applications that help companies and governments manage data dynamically

A

linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

A

singly linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

this enables a program to move through a list in both directions

A

doubly linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

true or false: programmers choose arrays over linked lists because arrays can grow and shrink in size during runtime

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

process for changing the size of an array

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

process of changing the size of a linked list

A

the operating system changes references to the previous item and the next item on the list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

each entry in a linked list

A

node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

parts of a node in a singly linked list

A

data, pointer to the next node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

parts of a node in a doubly linked list

A

data, pointer to the next node, pointer to the previous node

17
Q

main difference between normal linked list and circularly linked list

A

normal linked list - last node pointer is addressed to NULL

circularly linked list - last node pointer is addressed to first node

18
Q

how to create a linked list

A
  • 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
19
Q

steps to insert a new node to a linked list

A
  1. allocate memory for the new node
  2. point new node to its successor
  3. point the new node’s predecessor to the new node