Download Class A2 IGCSE Computing Chapter 32 Number Bases

Transcript
1. If list is full.
At the start of the algorithm you can add :
If nextfree = 0 then
Write “List is full” and exit procedure.
2. If you want to insert into an empty list :
In an empty list pointers will be populated and start will be 0 and
nextfree will be 1.
1
2
2
3
3
4
4
5
5
6
6
0
If start = 0 then
Temp = node[nextfree].pointer (node[1].pointer = 2)
Node[nextfree].pointer = 0 (node[1].pointer will be set to 0)
(there are 2 zeros in a linked list, one at the position where next item is
not there and one at the last element)
Start = nextfree (1)
Nextfree = temp (2 from statement 1)
Else
21