Skip to content

Commit 6616586

Browse files
Update README.md
1 parent 4a811bc commit 6616586

File tree

1 file changed

+137
-2
lines changed

1 file changed

+137
-2
lines changed

README.md

Lines changed: 137 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,137 @@
1-
# skew_heap-dsa-project
2-
This is a research and analysis of Skew Heap data structure as part of DSA coursework. I collaborated in team of 3 to produce 35-page technical report with mathematical proofs and experimental results of complexity analysis and implementation in C++.
1+
# Skew Heap - Data Structures and Algorithms Project
2+
3+
A comprehensive implementation and analysis of Skew Heap data structure, developed as part of the Data Structures and Algorithms coursework at the University of Science, VNU-HCM.
4+
5+
## 📋 Project Overview
6+
7+
This project provides a complete study of **Skew Heap**, a self-adjusting heap data structure that focuses on optimizing merge operations. Unlike traditional heaps, Skew Heap maintains heap properties without structural constraints, relying on unconditional child swapping to ensure efficiency.
8+
9+
### Key Features
10+
- 🔄 **Efficient Merge Operations**: O(log n) amortized time complexity
11+
- 🏗️ **Self-Adjusting Structure**: No additional structural properties required
12+
- 📊 **Comprehensive Analysis**: Includes best-case, worst-case, and amortized complexity analysis
13+
- 🔍 **Performance Comparison**: Detailed comparison with Binary Heap and Leftist Heap
14+
- 💻 **Complete Implementation**: Both recursive and iterative merge algorithms
15+
16+
## 👥 Team Members
17+
18+
| Name | Student ID | Role |
19+
|------|------------|------|
20+
| Nguyen Dinh Le Vu | 24120016 | Report: Overview, Basic Operations, Merge Complexity Analysis |
21+
| Nguyen Phuoc Khang | 24120189 | Report: Implementation & Complexity, Programming; Source Code: Merge, Insert, ExtractMin, Build Operations |
22+
| Pham Minh Dat | 24120174 | Report: Heap Comparison Analysis; Source Code: Utility functions |
23+
24+
## 🏗️ Project Structure
25+
26+
skew-heap-project/
27+
├── src/
28+
│ ├── SkewHeap.cpp # Core Skew Heap implementation
29+
│ ├── RecordSkewHeap.cpp # Extended version with performance tracking
30+
│ ├── RecordSkewHeap.h # Header file with declarations
31+
│ └── Main.cpp # Main program with test cases
32+
├── docs/
33+
│ └── report.pdf # Comprehensive 35-page technical report
34+
├── README.md # This file
35+
└── skew_heap.exe # Compiled executable
36+
37+
text
38+
39+
## 🚀 Getting Started
40+
41+
### Prerequisites
42+
- C++ compiler with C++11 support (GCC recommended)
43+
- Minimum stack size of 16MB for recursive operations
44+
45+
### Compilation
46+
cd project-directory
47+
g++ -std=c++11 --stack=16777216 *.cpp -o skew_heap
48+
49+
text
50+
51+
### Running the Program
52+
./skew_heap
53+
54+
text
55+
56+
## 🔧 Core Operations
57+
58+
### 1. Merge Operation
59+
The fundamental operation that combines two Skew Heaps while maintaining heap properties.
60+
61+
**Time Complexity:**
62+
- Best Case: O(1)
63+
- Worst Case: O(n)
64+
- Amortized: O(log n)
65+
66+
### 2. Insert Operation
67+
Inserts a new element by creating a single-node heap and merging with existing heap.
68+
69+
**Time Complexity:** Same as merge operation
70+
71+
### 3. Extract Minimum
72+
Removes and returns the minimum element (root) by merging left and right subtrees.
73+
74+
**Time Complexity:** Same as merge operation
75+
76+
## 📊 Performance Analysis
77+
78+
### Amortized Analysis
79+
Our implementation achieves **O(log n) amortized time complexity** for all major operations using potential function analysis. The potential function Φ(H) is defined as the number of heavy right nodes in heap H.
80+
81+
### Comparison with Other Heaps
82+
83+
| Operation | Binary Heap | Leftist Heap | Skew Heap |
84+
|-----------|-------------|--------------|-----------|
85+
| Insert | O(log n) | O(log n) | O(log n)* |
86+
| Extract Min | O(log n) | O(log n) | O(log n)* |
87+
| Merge | O(n) | O(log n) | O(log n)* |
88+
| Find Min | O(1) | O(1) | O(1) |
89+
90+
*Amortized complexity; worst-case may be O(n)
91+
92+
## 🎯 Key Contributions
93+
94+
1. **Theoretical Analysis**: Complete mathematical proof of O(log n) amortized complexity
95+
2. **Implementation Variants**: Both recursive and non-recursive merge algorithms
96+
3. **Performance Tracking**: Built-in comparison counting and timing mechanisms
97+
4. **Comprehensive Testing**: Multiple test cases covering edge cases and performance scenarios
98+
5. **Educational Value**: Detailed explanations and visualizations for learning purposes
99+
100+
## 📈 Applications
101+
102+
- **Priority Queues**: Efficient mergeable priority queue implementation
103+
- **Graph Algorithms**: Suitable for algorithms requiring frequent merge operations
104+
- **Functional Programming**: Simple structure ideal for functional language implementations
105+
- **Parallel Processing**: Merge capability useful in parallel and distributed systems
106+
107+
## 🔬 Research Insights
108+
109+
Our analysis reveals that while Skew Heap may have O(n) worst-case performance, its amortized O(log n) complexity makes it practically efficient. The unconditional swapping strategy eliminates the need for maintaining additional structural information (like NPL in Leftist Heaps), resulting in simpler implementation with comparable performance.
110+
111+
## 📚 Documentation
112+
113+
For detailed theoretical analysis, proofs, and extensive examples, please refer to our [comprehensive technical report](docs/report.pdf) (35 pages, in Vietnamese).
114+
115+
## 🎓 Academic Context
116+
117+
This project was completed as part of:
118+
- **Course**: Data Structures and Algorithms
119+
- **Institution**: Faculty of Information Technology, University of Science, VNU-HCM
120+
- **Instructors**: Dr. Nguyen Thanh Phuong, Dr. Nguyen Thanh Tinh
121+
- **Date**: May 25, 2025
122+
123+
## 📝 License
124+
125+
This project is developed for educational purposes. The LaTeX template used in the report is provided under GNU General Public License v3.0.
126+
127+
## 🤝 Contributing
128+
129+
As this is an academic project, contributions are limited to the original team members. However, feedback and suggestions for improvement are welcome for future iterations.
130+
131+
## 📞 Contact
132+
133+
For questions about this implementation or the theoretical analysis, please contact the team members through their university email addresses.
134+
135+
---
136+
137+
**Note**: This implementation is designed primarily for educational and research purposes. For production use, consider additional optimizations and error handling mechanisms.

0 commit comments

Comments
 (0)