الانتقال إلى المحتوى

Stacks, queues and linked lists

English

Three ways to keep items in order

  • AS topic 10.4: a stack, a queue and a linked list are abstract data types (ADTs). You must use them and say how an array can store them.
  • A stack is like a pile of plates: you add and remove at the top only. The last item in is the first out (LIFO).
  • A queue is like a line at the canteen: you join at the rear and leave at the front. The first item in is the first out (FIFO).
  • In a linked list, each item stores a pointer to the next item. The items can sit anywhere in memory.

A stack adds and removes at the top; a queue joins at the rear and leaves at the front; in a linked list each item points to the next

The same three items leave a stack and a queue in opposite orders.

ورقة عمل

تسجيل الدخول أو إنشاء حساب

IGCSE, A-Level & AP