Essential algorithms and data structures

Data structures

Supported by some programming languages within the command set, programmers often implement these structures using the fundamental data structures as building blocks.

What is a stack?

A stack is an essential data structure for the operation of a computer.  Items are “pushed” onto the top of the stack when added and “popped” off the top of the stack when deleted.  It is also possible to “peek” at the top item without deleting it.

Imagine a stack of coins. A coin can be added or removed from the top but not the middle.  The only way of accessing items in the stack is from the top.

A stack is known as a last-in, first-out or LIFO structure.  The last item pushed must be the first item popped.

A stack has a “stack pointer” that always points to the node at the top of the stack.

An attempt to push an item to an already-full stack is called a stack overflow, while attempting to pop an item from an empty stack is called a stack underflow. Both should be considered before proceeding to push or pop the item in question.

A stack is often implemented using an array but can also be created using object-oriented techniques.

Stack videos

What extra is in the book?

Each algorithm / data structure has its own dedicated chapter in the book, which includes:

  1. Overview
  2. Typical applications / uses
  3. Typical operations
  4. The algorithm written out in simple-structured English
  5. The algorithm written out in pseudocode
  6. Full code listing in Python
  7. Additional code listings in Visual Basic and C# are also available to download
  8. Diagrammatic walk-through
  9. Efficiency discussion with reference to Big-O notation

A hard copy of the book is available on our shop and a free PDF copy is included for all premium subscribers.

Registered in England and Wales: 10442992

VAT Number: 290 9845 58

Telephone: 03330 164 059

Email: admin@craigndave.co.uk

BETT Finalists 2022
Teach Secondary Awards 2022 Finalist