This project is a C-based database indexing simulator developed as part of the Computer Engineering curriculum at Dokuz Eylül University. It demonstrates advanced file organization, memory management, and sorting algorithms by simulating a multi-level relational structure (Country
- Multi-Level Indexing: Implements an array-based Singly Linked List architecture to map hierarchical data without traditional pointer nodes, optimizing memory lookup.
- Binary File Management: Direct disk access using
fseek,fread, andfwriteon aBinary.datfile. Only offsets are stored in RAM, significantly reducing memory footprint during searches. - Replacement Selection Sort (RSS): Generates initial sorted runs using a min-heap structure, dynamically handling incoming data streams. Includes step-by-step console visualization.
- Natural Merge Sort: Efficiently combines the runs generated by the RSS algorithm into a fully sorted dataset.
- Zero Memory Leaks: Strict dynamic memory management (
malloc/free) ensuring system stability during execution and upon exit.
- Language: C
- Concepts: File Structures, Min-Heap, Array-Based Linked Lists, Ternary Search Trees / Indexing, Memory Allocation.
- The system reads initial unsorted data and allocates necessary memory arrays.
- It builds the primary indices (
countries,city_index,product_index). - Users can interact with the data via a CLI menu (Insert, Search, Visualize Sort).
- For product searches, the system queries the RAM-based index to find the exact byte offset, then jumps to that location in the
.datfile to retrieve the complete record in$O(1)$ disk access time. - All newly inserted data is appended to the
.datfile in binary append mode (ab), updating the indices in real-time.