lists and linked lists Flashcards

1
Q

What is the definition of a list?

A

A data structure consisting of a number of items in which the items can occur more than once.

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

What are the main differences between arrays and lists?

A
  • Lists can store data non-contiguously whereas arrays store data in order.
  • Lists can store data of more than one data type.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a tuple?

A

An immutable, ordered set of values of any type.

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

What is the difference between a tuple and an array?

A

Tuples are initialised using regular brackets instead of square brackets.

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

What is a linked list?

A

a list where each item contains the data Contiguously with a pointer to the next item.

there may be an additional pointer to the previous item

this means that the items can be accessed in order even if they are not stored in order

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

What is the name given to the items in a linked list?

A

Nodes

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

What does each item in a linked list contain?

A

t contains a data field and another address field called a link/pointer

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

What is a data field in a linked list?

A

A field that stores the actual data.

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

What is a pointer field in a linked list?

A

A field that contains the address of the next item in the list.

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