This project demonstrates the implementation of a Max-Heap data structure in Java. A Max-Heap is a complete binary tree where each parent node is greater than or equal to its children. It is widely used in priority queues, heap sort, and graph algorithms like Dijkstraβs shortest path.
This assignment also includes performance benchmarking to analyze the time complexity of heap operations and visualize their behavior with Python-generated plots.
insert()
β Adds elements while maintaining the max-heap propertyextractMax()
β Removes and returns the largest elementincreaseKey()
β Increases the value of a node and restores heap order- Efficient heap operations with performance measurement
- Automated benchmarking with data visualization (CSV + PNG)
assignment2-maxheap-full/
β
βββ docs/
β βββ performance-plots/
β βββ benchmark_results.csv # Generated benchmark data
β βββ performance_plot.png # Execution time visualization
β
βββ src/
β βββ main/
β β βββ java/
β β β βββ algorithms/
β β β β βββ MaxHeap.java
β β β β βββ MaxHeapImplementation.java
β β β βββ cli/
β β β βββ BenchmarkRunner.java
β β βββ metrics/
β β βββ PerfermanceTracker
β β
β βββ test/
β βββ java/
β βββ algorithms/
β βββ MaxHeapImplementationTest.java
β
βββ README.md # Project documentation
βββ pom.xml # Build configuration
- Build with Maven:
mvn clean package
- Run benchmarks:
java -cp target/maxheap-1.0.jar cli.BenchmarkRunner
This will create the file:
docs/performance-plots/benchmark_results.csv
The benchmark results confirm that:
- Heap insertion and extraction grow approximately at O(log n) per operation.
- For larger input sizes, total execution time scales linearly with the number of operations.
- This matches the expected theoretical performance of a Max-Heap.
- Zainiddin Tursunaliev Assignment 2 β Data Structures & Algorithms