An open API service indexing awesome lists of open source software.

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

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.