112
Dispatching 112
How Data Structures Save Lives
Mohamed Osama — 314CD — SDA • Tema 1
Every Second Counts
In emergency centers, we deal with human lives.

Paper-based tracking

A nightmare under pressure — slow, error-prone, unscalable.

Naive data storage

Breaks down when sorting and prioritization matter.

No time to sort

The system must decide instantly — not the operator.

The Building Blocks

Units

Static Array
id=1A ✓id=2B ✓id=3C ✓[49]

Incidents

Circular Doubly Linked List
Sentinelid=0Inc 1highInc 2med

Priority Queues

FIFO
HIGHInc2Inc5→ dispatchMEDInc3LOWInc1

Dispatch Stack

LIFO
Interv 3 ← TOPInterv 2Interv 1UNDOPUSH
🔑

Queues and stack store pointers, not data. One source of truth.

How the System Works
How the System Works
How the System Works
How the System Works
How the System Works
How the System Works
How the System Works
Results
All tests passed. All requirements met.
0

Operations

Implemented & tested

0

Memory Leaks

Valgrind clean — 20pt

1→5

Generic Structure

void* queue, 5 uses

0

Special Cases

Sentinel pattern

What I Built, What I Learned
LIFO vs FIFO — when each behavior matters
Stack & Queue — same blocks, different rules
Pointers — from scary to natural
void* casting — one structure, many shapes
"The right data structure doesn't just store data — it makes the right decisions easier to write."
What's Next
Three directions to extend the system

Smart Matching

Match unit type with incident type.

type matching

Faster Lookups

Hash tables: O(n) → O(1).

O(1)

Dashboard

Live map for dispatchers.

real-time
The data structures are in place. Make them visible — and intelligent.
1 / 13