Chapter 35 - Lists And Linked lists Flashcards

1
Q

State an advantage of using linked lists

A

The data can be sorted In different ways without making any changes to the original data.

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

How can data be ordered and maintained?

A

It is possible to maintain an ordered collection of data items using and array, which is a static data structure

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

How is a linked list initialised?

A

The array is initialised before entering any data.

After initialisation a pointer named start will point to the first data item in the list.

This will be initialised to null indicating that the list is empty.

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

What happens when a new item is added to the list

A

Data is stored at the location indicated by the free storage pointer

Alter the free storage pointer to the next free storage space

Identify where in the list it is to be inserted

Set the pointer for the item that will precede it to the new data item

Update the pointer for the new data item to that previously stored in the item that preceded it

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

To delete data from the list

A

Follow the pointers until data item to delete is found

Change the previous nodes pointer to point to the node pointer to by the item that is being deleted

Change data item being deleted to point to nextfree

Change nextfree to point to node being deleted

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

Note

A

Data isn’t physically removed from the structure, instead the pointer is used to say the item can be overwritten

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

what is a linked list?

A

A data structure that provides a foundation where other structures can be built.

e.g. stacks, queues, graphs and trees

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

describe the structure of a linked list

A

A linked list is constructed from nodes and pointers

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

what identifies the first node?

A

A start pointer identifies the first node

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

what does every node contain in a linked list?

A

each node contains data and a pointer to the next node

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

state one advantage of using linked lists

A

data in lists can be stored anywhere in memory, with pointers indicating the address of the next item

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

how can a circular linked list be created?

A

A circular linked list can be created by making the last node point to the first node

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

how can a doubly linked list be created?

A

by adding an extra pointer, nodes can point to the previous and next items, known as a doubly linked list

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

what is a doubly linked list?

A

a list containing 2 pointers with nodes that can point to previous and next items

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