Repository of problems and solutions of labsheets used for Data Structures and Algorithms (CS F211) in Semester 2, 2020-21 at BITS Pilani - Hyderabad Campus.

CS F211 Data Structures and Algorithms (BITS Pilani - Hyderabad Campus)

This repository contains the problems, solution approaches & explanations and (for some problems) psueodocode or C code to solve the problem. In general, this repository will be updated with the latest labsheet around 5-7 days after the last lab evaluation on that labsheet is complete. Directories a0, a1, ... contain the solutions for the respective labsheets. A README/PDF file will be included in each of these, with the solution explanations for (atleast) some of the problems.

Contribution Guidelines

When submitting a pull request please make sure your file name is in the format (Problem Number)_(Your name).c. Since we'll be getting many solutions for each problem, this helps us keep track of each one and also people know who's code it is when they look at it. Please make sure the Problem number is first so that all the codes for one question will be together in the repo (The repo keeps files in alphabetical order)

Ex: F_pranav_reddy.c or F_pranavreddy.c

Please make sure that your code passes all possible test cases to the best of your ability. Refrain from posting solutions that you know are wrong. Also make sure that you are putting the solution in the correct assignment folder to avoid future confusion. We are currently accepting PRs for Assignments 1, 2, 3 and 4 only. If a certain question already has answers, please try to add another solution only if you believe your approach is significantly different/unique/more understandable.

Solution Availability

C code for these questions is currently available:

Assignment A B C D E F G H I J
A0 ✔️
A1 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
A2 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
A3 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️

If a problem doesn't have a solution so far (cross), or you feel that you can improve the current solution, please feel free to either (1) raise an issue (2) start a pull request with your changes or (3) contact a TA.

Contributors

Your name will be listed here if you contribute a solution.

Owner
Rohit Dwivedula
Undergraduate student of Computer Science at BITS Pilani Hyderabad Campus (2021).
Rohit Dwivedula
Comments
  • Add a8{A, D, H}, a9{A, B, C, D, E, G, I, J}

    Add a8{A, D, H}, a9{A, B, C, D, E, G, I, J}

    Optimized solutions / probably uncommon ideas / painful implementation / whatever ;v

    | Problem | Tags | Time Complexity | |:-------------:|-------------|:-------------| | a8 A | implementation, trees, bfs | O(n) | | a8 D | implementation, trees, dfs | O(n + Q·logn) | | a8 H | dp, prefix sums, sorting
    hashing, binary search | O(n·logn) |

    | Problem | Tags | Time Complexity | |:-------------:|-------------|:-------------| | a9 A | implementation, trees,
    data structures, red black tree | O((n+Q)·logn) | | a9 B | implementation, greedy | O(n) | | a9 C | greedy, sorting | O(n·log(ai) + n·logn) | | a9 D | dp, prefix sums, sorting
    hashing, binary search | O(n·logn) | | a9 E | dp, trees, dfs | O(n) | | a9 G | troll | O(n) | | a9 I | brute force, prefix sums | O(n + A·A) | | a9 J | implementation, trees, dfs | O(n) |

  • Add a8{A, D, H}

    Add a8{A, D, H}

    Optimized solutions / probably uncommon ideas / painful implementation

    | Problem | Tags | Time Complexity | |:-------------:|-------------|:-------------| | a8 A | implementation, trees, bfs | O(n) | | a8 D | implementation, trees, dfs | O(n + Q·logn) | | a8 H | dp, prefix sums,
    hashing, binary search | O(n·logn) |

  • Add a7{E, F}

    Add a7{E, F}

    Optimized solutions / probably uncommon ideas

    | Problem | Tags | Time Complexity | |:-------------:|-------------|:-------------| | a7 E | bitmasks, dp | O(n·log10 x) | | a7 F | implementation, strings,
    data structures, trie | O(Σ\|s\|) |

  • Add Solutions for A6 {C, E}

    Add Solutions for A6 {C, E}

    A6_C - Triad - Used binary search and a more organized code. A6_E - Anomaly Detection - Used a bucket structure to store the values of different ranges, and then calculated the normality score.

  • Add a5{C, E}, a6{H}

    Add a5{C, E}, a6{H}

    Optimized solutions / probably uncommon ideas

    | Problem | Tags | Time Complexity | |:-------------:|-------------|:-------------| | a5 C | Dynamic Programming, Greedy | O(n + m) | | a5 E | Binary search
    - with solution to extra challenge | O((n + k)·log(max ai))
    O(k·log(max ai)) | | a6 H | Data structures, Implicit treaps,
    lazy propagation, randomization | O(n + Q·logn) |

  • Add a1{H, J}, a3{H}, a4{B, C, F}

    Add a1{H, J}, a3{H}, a4{B, C, F}

    Optimized solutions / probably uncommon ideas

    | Problem | Tags | Time Complexity | |:-------------:|-------------|:-------------| | a1 H | prefix sums, dynamic programming | O(n) | | a1 J | graphs, bipartite check, dsu | O(min(n, m)·logn + m) | | a3 H | graphs, greedy, sorting | O(n·logn) | | a4 B | implementation | O(n·logn) | | a4 C | graphs, shortest paths, bfs,
    binary search, hashing, randomization | O(n·Wordlen·Alphsize·logn) | | a4 F | geometry, sorting, 2-pointer | O(n·logn) |

Data structures and algorithms topicwise practice problems in C++
Data structures and algorithms topicwise practice problems in C++

Data-Structure-and-Algorithm data structures and algorithms topicwise practice problems in C++ Q. find maximum element in an array Q. Sum of all Subar

Jan 10, 2022
This repository aims to contain solutions and explanations to various competitive programming problems, which may be important for interviews and online tests of different companies.
This repository aims to contain solutions and explanations to various competitive programming problems, which may be important for interviews and online tests of different companies.

Competitive Programming Solutions Compilation Hello everyone ?? This repository contains solutions and explanations to various competitive programming

Aug 14, 2022
This Repository is based on Striver DSA Sheet problems solved by me for Interview preparation. All solutions are coded in C++ language.

Striver DSA Sheet Striver DSA Sheet Link This Repository is based on Striver DSA Sheet problems solved by me (sometimes with help from different resou

Aug 6, 2022
An assortment of commonly used algorithms and data structures implemented with C++.

Algorithms-And-Data-Structures This repo contains C++ implementations of common algorithms and data structures, grouped by topics. The list will be sp

Nov 9, 2021
The aim of this repository is to make it a one final stop for revision for technical interviews involving data structures and algorithms .

Hey ??‍♂️ This repository is meant for data structures and algorithms . I will be updating this often and will include all the data structures importa

Jul 19, 2022
A repository by [email protected] for data structures and algorithms
A repository by Codechef@MUST for data structures and algorithms

DSA Overview The main goal of this project is to promote open-source, allowing anyone who wants to contribute. This repository would be focused on var

Jul 27, 2022
A repository by [email protected] for data structures and algorithms
A repository by Codechef@MUST for data structures and algorithms

DSA Overview The main goal of this project is to promote open-source, allowing anyone who wants to contribute. This repository would be focused on var

Jul 27, 2022
This repository contains the advanced basic reference codes of Data Structures and Algorithms.

CSE-DSA-Codes This repository contains the advanced basic reference codes of Data Structures and Algorithms, which are coded in C and C++ Language, wh

Dec 7, 2021
This repository contains the Assignment code of Data Structures and Algorithms Assignments of SPPU, Second Year IT Syllabus (2019 pattern)

DSAL This repository contains the Assignment code of Data Structures and Algorithms Assignments of SPPU, Second Year IT Syllabus (2019 pattern) Assign

Apr 6, 2022
This is my repository of Data Structures and Algorithms.
This is my repository of Data Structures and Algorithms.

DATA-STRUCTURE-AND-ALGORITHMS-DSA- This is my repository of Data Structures and Algorithms. It includes topics: AVL Trees Determining whether the give

Apr 13, 2022
Data Structure and Algorithms problems across various platforms.
Data Structure and Algorithms problems across various platforms.

Covering various practice problems of Arrays, Stacks, queue, tree, graph and different Algorithms. A collection of solutions for Data Structure and Algorithms problems across various platforms in different languages.

Jul 2, 2022
My solutions to problems of Global Coding Challenge 2021

Global Coding Challenge 2021 Organized by Credit Suisse This repo contains all the problems of the competition and solutions to them submitted by bpan

Nov 7, 2021
Solutions of assignments, problems of DSA bootcamp in C++ by Kunal kushwaha OR Community Classroom

Problem-solution Solutions of assignments, problems of DSA bootcamp in C++ by Kunal kushwaha OR Community Classroom DSA-Bootcamp ?? Assignments ✨ Solu

Nov 6, 2021
LeetCode Problems' Solutions

leetcode LeetCode Problems' Solutions # Title Solution Difficulty 6 Remove Duplicates from Sorted List C++ Easy 5 Palindrome Number C++ Easy 4 Median

Dec 28, 2021
Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design
Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design

Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. It contains solutions in various languages such as C++, Python and Java.

Jul 24, 2022
Templates, algorithms and data structures implemented and collected for programming contests.
Templates, algorithms and data structures implemented and collected for programming contests.

Templates, algorithms and data structures implemented and collected for programming contests.

Aug 6, 2022
🔗 Common Data Structures and Algorithms

?? Data Structures and Algorithms This library provides common data structures. It will also provide some data structures which needed in render or ga

Aug 3, 2022
Wonderful library with lots of useful functions, algorithms and data structures in C, link it with -l9wada

Lib9wada Wonderful library with lots of useful functions, algorithms and data structures in C, link it with -l9wada Usage Compile the library with mak

Aug 15, 2022