K⁠-⁠d tree and extendible hashing

Two assignments for Algorithms and Data Structures 2: a k⁠-⁠d tree finds properties and parcels by GPS, and extendible hashing keeps cars and their service records in binary files on disk.

Role
Solo assignment: design, implementation, GUI
Period
10/2024 – 12/2024
Stack
  • Java

In short

  • 3 k⁠-⁠d trees at once: properties, parcels, everything
  • Deleting from a tree where several records share a key
  • Deletes merge blocks and shrink the directory

The problem

The first task: find every property and parcel at a given GPS point. The second: a register of cars in files on disk, where a car is found by ID or licence plate without scanning the whole file.

What I built

  • A generic k⁠-⁠d tree without recursion, including deletes with duplicate keys
  • A heap file with fixed-size blocks and extendible hashing that splits and merges blocks
  • Records serialised to bytes by hand; the data survives an application restart
  • A Swing GUI, a data generator and a block⁠-⁠by-block file dump

Result

About 7,600 lines of Java in two public repositories. The hardest part was deleting from the tree when several records share the same coordinates.

What I would do next

Today the tree only finds an exact point. The next step would be a range search for everything inside a rectangle.

Looking for a backend developer or a similar app?

Send me a few lines. I reply within 2 working days.