https://github.com/saifiimuhammad/data-structures-algorithms
This repository contains implementations of common algorithms and Leetcode problems in C++.
https://github.com/saifiimuhammad/data-structures-algorithms
algorithms cpp data-structures leetcode
Last synced: about 1 month ago
JSON representation
This repository contains implementations of common algorithms and Leetcode problems in C++.
- Host: GitHub
- URL: https://github.com/saifiimuhammad/data-structures-algorithms
- Owner: saifiimuhammad
- Created: 2024-09-25T17:41:50.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-18T10:40:50.000Z (about 1 year ago)
- Last Synced: 2025-03-26T11:17:02.071Z (8 months ago)
- Topics: algorithms, cpp, data-structures, leetcode
- Language: C++
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Data Structures and Algorithms
This repository contains implementations of common algorithms in **C++**. Below is a brief overview of each algorithm, its time complexity, and typical usage scenarios.
## Sorting Algorithms
1. **Bubble Sort**
- **Time Complexity:** O(n²)
- **Usage:** Simple but inefficient, used for small datasets or educational purposes.
2. **Selection Sort**
- **Time Complexity:** O(n²)
- **Usage:** Better than bubble sort for small datasets, useful for learning purposes.
3. **Quick Sort**
- **Time Complexity:** O(n log n) on average
- **Usage:** Efficient for large datasets; performance may degrade with bad pivot choices.
4. **Merge Sort**
- **Time Complexity:** O(n log n)
- **Usage:** Stable and consistent, ideal for large datasets where stability is required.
5. **Insertion Sort**
- **Time Complexity:** O(n²)
- **Usage:** Efficient for small datasets and nearly sorted data.
---
## Problem-Solving
1. **Two Sum Problem**
- **Description:** Find two numbers that add up to a target value.
- **Time Complexity:** O(n)
- **Usage:** Common problem in coding interviews.
2. **Counter Problem**
- **Description:** Count occurrences of elements in an array.
- **Time Complexity:** O(n)
- **Usage:** Useful for frequency counting.
3. **Remove Duplicates**
- **Description:** Remove duplicates from a sorted array.
- **Time Complexity:** O(n)
- **Usage:** Simplifies an array by removing duplicate values.
---
## Credits
Developed by [Muhammad Saif](https://github.com/saifiimuhammad).