Pular para o conteúdo

Insert, delete, split and sort

English

A list that grows and shrinks

  • Paper 2 often stores a list in an array that is bigger than the data: Scores : ARRAY[1:6] with only 4 cells used.
  • A second variable, Count, says how many cells hold data. Cells after Count are spare.
  • Adding or removing an item means moving other items and changing Count. This lesson shows four jobs the papers ask for.

Insert 28 into 12, 25, 31, 47: 47 and 31 are copied one cell right, then 28 goes into cell 3 and Count becomes 5

Entrar ou criar conta

IGCSE, A-Level & AP