https://github.com/parth1899/daa-course-programs
Implementations of algorithmic problems taught in the Design and Analysis of Algorithms course curriculum
https://github.com/parth1899/daa-course-programs
Last synced: about 1 year ago
JSON representation
Implementations of algorithmic problems taught in the Design and Analysis of Algorithms course curriculum
- Host: GitHub
- URL: https://github.com/parth1899/daa-course-programs
- Owner: parth1899
- Created: 2025-02-24T04:33:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-01T17:25:14.000Z (about 1 year ago)
- Last Synced: 2025-04-01T18:33:13.384Z (about 1 year ago)
- Language: C++
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Design and Analysis of Algorithms (DAA) Assignments**
This repository contains implementations of various algorithms taught in the **Design and Analysis of Algorithms (DAA)** course. The assignments cover a range of fundamental algorithmic problems, including sorting, searching, combinatorial problems, and majority element detection.
## **Assignments Overview**
### **Assignment 1: Derangements & Maximum Updates**
1. **Number of Derangements** – Counting valid permutations where no element appears in its original position.
2. **Max Updates in Unsorted Array** – Finding the average number of updates required to track the maximum element for all possible `n!` arrays.
### **Assignment 2: Sorting Algorithms**
1. **Quick Sort** – A divide-and-conquer sorting algorithm with an average time complexity of `O(n log n)`.
2. **K-Way Merge Sort** – A variation of merge sort that merges `k` sorted sequences efficiently.
### **Assignment 3: Josephus Problem**
1. **Array-Based Solution** – Simulates the elimination process using an array.
2. **Circular Linked List-Based Solution** – Implements an efficient approach using a circular linked list.
### **Assignment 4: Fast Modular Exponentiation**
1. **Brute Force Approach** – Computes exponentiation using straightforward multiplication.
2. **Recursive Approach** – Uses divide-and-conquer for efficient modular exponentiation.
### **Assignment 5: Majority Element Search**
A number is a **majority element** if it appears more than `n/2` times in an array. Implementations include:
1. **Brute Force** – Counts occurrences for each element.
2. **Sorting-Based Approach** – Uses sorting to locate the majority element.
3. **Boyer-Moore Majority Voting Algorithm** – A space-efficient algorithm to find the majority element in `O(n)` time.
### **Assignment 6: Patience Sorting**
1. **Patience Sorting Algorithm** – Used to find the longest increasing subsequence in `O(n log n)`.
### **Assignment 7: Kadane's Algorithm for Maximum Contiguous Block Sum**
1. **Brute Force Approach** – Checks all subarrays to find the maximum sum.
2. **Optimized Brute Force** – Reduces redundant calculations for better performance.
3. **Kadane's Algorithm** – An efficient `O(n)` approach to find the maximum sum of a contiguous subarray.
### **Assignment 8: Kruskal's Algorithm for Minimum Spanning Tree (MST)**
1. **Kruskal's Algorithm** – A greedy algorithm to find the MST of a graph using the Union-Find data structure.