Skip to content

DSA Lab · 8 experiments

Run every structure on real heat.

Each lab experiment powers one HEATSYNC module. Pick a replay day from the May 2024 heatwave, run the operations on that day’s readings and step through every comparison, pointer move and probe, with the C program alongside.

structures
8
districts
36
replay days
17
lines of C
4,123

Replay day · feeds every experiment

26 May 2024

19 of 36 districts ≥ 40 °C · 2 in heatwave
hottest Nagpur 45.8 °C

May 2024 · bar height = districts ≥ 40 °C, colour = day’s hottest reading · ERA5 reanalysis via Open-Meteo (CC BY 4.0)

Exp 01 · Array of structures

Station Registry

AimImplement and demonstrate the use of arrays, array of structure and pointers using C.

In HEATSYNCFixed-capacity registry of the 36 district automated weather stations; insert/delete at the end, linear search by code or name.

Operations · real data

insertLast()

O(1)

Next hottest station: MH32 Nagpur · 45.8 °C

deleteLast()

O(1)

The registry is empty, so this delete will underflow.

search()

O(n)

Linear scan by code or district name, case-insensitive.

struct Station registry[8]

size 0 / 8sizeof = 48 B
  1. [0]0x6000

    empty

    ▲ size = 0
  2. [1]0x6030

    empty

  3. [2]0x6060

    empty

  4. [3]0x6090

    empty

  5. [4]0x60C0

    empty

  6. [5]0x60F0

    empty

  7. [6]0x6120

    empty

  8. [7]0x6150

    empty

&registry[i] = 0x6000 + i × 48. Insert writes registry[size] and increments size; delete clears registry[size − 1].

display() · slots[0 … size − 1]

No stations yet. Insert the hottest districts of the day.

Run an operation above. Every step it takes will replay here.

000 / 000

Operations log

newest first

Every call is logged here. Select an entry to replay its steps.

Time complexity

OperationCost
insertLastO(1)
deleteLastO(1)
searchO(n)
displayO(n)