Arrays Flashcards

1
Q

memory address

A

the index number of RAM

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

Linked lists

A
  • data structures that overcome problems of space by allocating blocks of memory on demand
  • work by storing a series of nodes.
  • primary operations in a linked list are insert, remove, and get (find)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

node

A
  • unit of memory holding a single item in a linked list
  • A node can be allocated from anywhere in the memory, it does not have to be next to the previously allocated node. Hence, linked lists are stored in non-contiguous blocks of memory.
  • consists of a value and a pointer to the next node in the sequence
  • node class is named with a _ (underscore). The underscore simply indicates that the node class is a private class that should not be accessible by anyone else other than the linked list class.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

singly linked list

A
  • a type of linked list where each node contains one pointer to the next node
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

doubly linked list

A

-where nodes contain a pointer to the previous node in addition to the next

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

head

A
  • indicates the beginning of the list.

- The head always contains the 1st node

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

insertion

A
  • at the beginning of the list (insertFirst).
  • at the end of the list (insertLast).
  • anywhere in the list, between 2 nodes (insert, insertAt).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

insertFirst

A
  • Create a new node item

- Point the head to that new node

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

insertLast

A
  1. Create a new node item
  2. Check to see if the list is empty, if it is, then insert the new item as the only item in the list
  3. Start at the beginning of the list and move through the list until you reach the end of the list
  4. Set the end node’s next pointer to the new node
  5. The new node’s next pointer is null (indicating that the new node now is the last node on the list)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

get

A
  1. traverse the list, comparing the value stored in each node with the value you are searching.
  2. When the item is found, return the node.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

removal

A
  1. delete from the beginning of the list.
  2. delete from the end of the list.
  3. delete a node between 2 other nodes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

delete 1st

A

if you delete the 1st item in a list, you need to change the head to indicate the new 1st item on the list.

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

end or between

A

you find the node before the node you are removing and update its next pointer to skip over the removed node.

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