Skip to content

Linked list

storing

Level 1 of 3

Also called Sorted singly linked list.

fresh numbers

The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from linked list's own run on the numbers shown.

choose one

question 1

An empty chain kept in order puts in 70, 5 and 99, takes 5 out, then puts in 20. What does the chain hold then, from the start?

the answer, and why

the answer is C

After 5 leaves, the chain holds 70, 99. 70 is bigger than 20, so the first look stops the walk and 20 goes in at the start.

if you chose another

  • That keeps 5, but the fourth operation takes 5 out.
  • That puts 20 at the end, but a put stops at the first bigger number, 70.
  • That loses 70. Taking 5 out links the start to 70, which stays.

new numbersthe test page's numbers

question 2

Starting from an empty chain kept in order, you put in 11, 98, 48 and 14, in that order. How many looks do the four puts make in all?

the answer, and why

the answer is B

Put by put, the looks are 0 + 1 + 2 + 2, 5 in all: each put looks at every smaller number, and at the first bigger one, if any, where it stops.

if you chose another

  • That counts every place each time, as smallest first would, 0 + 1 + 2 + 3.
  • That counts one look a put, but a put looks at every smaller number before it stops.
  • That counts 1 look a put after the first, as biggest first would.

new numbersthe test page's numbers

question 3

Which order of putting 60, 64, 95 and 96 into an empty chain costs the fewest looks?

the answer, and why

the answer is B

Putting them in as 95, 96, 64, 60 takes 3 looks, the fewest of the four.

if you chose another

  • That order takes 6 looks, more than 3.
  • That order takes 5 looks, more than 3.
  • That order takes 4 looks, more than 3.

new numbersthe test page's numbers