2 CH 2
2 CH 2
(Array Based)
■ Groceries to be purchased
■ Job to-do list
■ List of assignments for a course
■ Dean's list
■ Upshot:
■ A sequence of zero or more elements
A 1, A 2, A 3, … A N
■ Insert Operation
■ It is possible to insert new elements at various
positions
■ Insert at start
■ Insert at end
■ Insert at specific position
if (si = -1)
Start Index(si)
Last Index(li)
Start Index(si)
Last Index(li)
■ si li
■ We have to shift elements towards end/shift
right to make the empty slot at the start of
array list
Department of Computer Science 17
Insertion at start
9 4 8
9 9 4 8
9 9 4 8
7 9 4 8
■ si li
4 8 6 12
23 4 8 6 12