Giter VIP home page Giter VIP logo

the-streamliners / data-structures-and-algorithms Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 100.0 1.63 MB

Hacktoberfest's DSA Challenge, create algorithms, programs in any programming language you love and prefer! Check the ISSUE section for ideas.

License: MIT License

C 7.66% Python 4.73% C++ 53.54% Java 24.37% Swift 9.69%
first-timers github beginner-friendly competitive-programming data-structures algorithms

data-structures-and-algorithms's Introduction

Hacktoberfest DSA Repository

Introduction

This repository contains all the Implementations of famous and popular algorithm and their implementations fork to make a reference for yourself and contribute to increase the repository's codebase.

This DSA repository can also be used to contribute to Hacktoberfest which is a month-long celebration to encourage developers to use and contribute to open source projects. Continuing with the tradition to encourage first timers to contribute.

How can I Contribute?

This repository is for you to learn to contribute to open source projects. Write an implementation of your favorite algorithm from the issues section in the programming language of your choice and submit a pull request to this repository. For ideas, check out the issues page!

Issues page is for your reference. You are to submit implementation of your choice of algorithm in any programming language if you think it is also important to be there..

Spamming with Illogical PRs about upadting, changing readme will not be considered. Please refer to Contributing.md for more info.

Steps to follow

  1. Create an empty directory in your local system and cd into it
mkdir open_source
cd open_source
  1. Initialize an empty git repository
git init

This command initializes your directory for git version control

  1. Fork this repository by clicking on the 'Fork' button

  2. Clone the forked repository in the directory you just made

git clone https://github.com/<your-github-username>/<repo_name>.git
  1. cd into the project repository and adding your implementation of your favorite algorithm in the programming language of your choice.
cd <repo_name>
cd Sorting
vim/subl/gedit/nano my-awesome-algorithm{.c/.cpp/.java/.py}
  1. Commit your changes
git add my-awesome-algorithm{.c/.cpp/.java/.py}
git commit -m "Add an implementation of my awesome algorithm in {C,C++,Java,Python}"

Here are some guidelines on how to write a great commit message.

  1. Push your commits
git push

This will prompt you to enter your github credentials for a successful push.

  1. Create your first Pull Request!
Go to 'Pull requests' tab of your forked repository
Click on 'New pull request'
Compare your changes
Create the pull request

Github Desktop Tutorial

Github Desktop can be also used if the above method seems complicated. It can be downloaded from here.

WATCH THE TUTORIAL ON HOW TO USE IT!

Github Tutorials

Although this should get you going, here are some awesome tutorials to help you create your first PR!

Happy Hacking!

Maintained by Atul Sharma

data-structures-and-algorithms's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

data-structures-and-algorithms's Issues

Write a implementation of GPA Calculator

Create a program to calculate GPA from grades of a student on the scale of 10.

Sample Input: "AAA+BCADE"
Sample Output: 7.87

Here: A+ represents 10, A represents 9, B represents 8 and son on till E representing 5.

Implementation of Standard Template libraries (STL)

Give Implementation for the following STLs:--

  1. Sequence Containers: implement data structures which can be accessed in a sequential manner.
  • vector
  • list
  • deque
  • arrays
  • forward_list( Introduced in C++11)
  1. Container Adaptors : provide a different interface for sequential containers.
  • queue
  • priority_queue
  • stack
  1. Associative Containers : implement sorted data structures that can be quickly searched (O(log n) complexity).
  • set
  • multiset
  • map
  • multimap
  1. Unordered Associative Containers : implement unordered data structures that can be quickly searched
  • unordered_set (Introduced in C++11)
  • unordered_multiset (Introduced in C++11)
  • unordered_map (Introduced in C++11)
  • unordered_multimap (Introduced in C++11)

Queue Implementation

  1. Implement Queue using Stacks
  2. LRU Cache Implementation
  3. Implement Stack using Queues
  4. Queue (Linked List Implementation)
  5. How to efficiently implement k Queues in a single array?
  6. Implement a stack using single queue
  7. Implementation of Deque using circular array
  8. Circular Queue (Circular Linked List Implementation)
  9. Implement Stack and Queue using Deque
  10. Priority Queue using Linked List
  11. Priority Queue using doubly linked list
  12. Implementation of Deque using doubly linked list

Stack Implementation

Stack operations may involve initializing the stack, using it and then de-initializing it. Apart from these basic stuffs, a stack is used for the following two primary operations −

push() − Pushing (storing) an element on the stack.

pop() − Removing (accessing) an element from the stack.

When data is PUSHed onto stack.

To use a stack efficiently, we need to check the status of stack as well. For the same purpose, the following functionality is added to stacks −

peek() − get the top data element of the stack, without removing it.

isFull() − check if stack is full.

isEmpty() − check if stack is empty.

Implement programs for following functions.

Implementation of Dynamic Programming

  1. Longest Common Subsequence
  2. Longest Increasing Subsequence
  3. Edit Distance
  4. Minimum Partition
  5. Ways to Cover a Distance
  6. Longest Path In Matrix
  7. Subset Sum Problem
  8. Optimal Strategy for a Game
  9. 0-1 Knapsack Problem
  10. Boolean Parenthesization Problem
  11. Shortest Common Supersequence
  12. Matrix Chain Multiplication
  13. Partition problem
  14. Rod Cutting
  15. Coin change problem
  16. Word Break Problem
  17. Maximal Product when Cutting Rope
  18. Dice Throw Problem
  19. Box Stacking
  20. Egg Dropping Puzzle

Implement different sorting algorithms.

  • Selection Sort,
  • Bubble Sort,
  • Recursive Bubble Sort,
  • Insertion Sort,
  • Recursive Insertion Sort,
  • Merge Sort,
  • Iterative Merge Sort,
  • Quick Sort,
  • Iterative Quick Sort,
  • Heap Sort,
  • Counting Sort,
  • Radix Sort,
  • Bucket Sort,
  • ShellSort,
  • TimSort,
  • Comb Sort,
  • Pigeonhole Sort,
  • Cycle Sort,
  • Cocktail Sort,
  • Strand Sort,
  • Bitonic Sort,
  • Pancake sorting,
  • Binary Insertion Sort,
  • BogoSort or Permutation Sort,
  • Gnome Sort,
  • Sleep Sort – The King of Laziness / Sorting while Sleeping,
  • Structure Sorting (By Multiple Rules) in C++,
  • Stooge Sort,
  • Tag Sort (To get both sorted and original),
  • Tree Sort,
  • Cartesian Tree Sorting,
  • Odd-Even Sort / Brick Sort,
  • QuickSort on Singly Linked List,
  • QuickSort on Doubly Linked List,
  • 3-Way QuickSort (Dutch National Flag),
  • Merge Sort for Linked Lists,
  • Merge Sort for Doubly Linked List,
  • 3-way Merge Sort

Graph Algorithms

Create a folder for graph algorithms and add algorithms like

  • bfs
  • dfs
  • dijkstra's algorithm
  • kruskal's minimum spanning tree

Implementation of Searching Alogrithms.

Linear Search
Binary Search
Jump Search
Interpolation Search
Exponential Search
Sublist Search (Search a linked list in another list)
Fibonacci Search
The Ubiquitous Binary Search
Recursive program to linearly search an element in a given array
Recursive function to do substring search
Unbounded Binary Search Example (Find the point where a monotonically increasing function becomes positive first time)

Implement a function which when given an entry point to a tree, prints its preorder, inorder and post-order traversal.

Implement a function which when given an entry point to a tree, prints its preorder, inorder and postorder traversal.

Write a sample use of the checker function in the main function of your program. Also, specify the data structure used for the tree.

Hint: Use recursion for succinct code. For the really adventurous, try doing the same iteratively (you will need to use a stack).

Implementation of string Data structure

    • Smallest number with sum of digits as N and divisible by 10^N
    • Minimum sum of squares of character counts in a given string after removing k characters
    • Maximum and minimum sums from two numbers with digit replacements
    • Check if a given string is sum-string
    • Sum of two large numbers
    • Calculate sum of all numbers present in a string
    • Extract maximum numeric value from a given string
    • Calculate maximum value using ‘+’ or ‘*’ sign between two numbers in a string
    • Maximum segment value after putting k breakpoints in a number
    • Difference of two large numbers
    • Check if a large number is divisible by 4 or not
    • Check if a large number is divisible by 11 or not
    • Number of substrings divisible by 6 in a string of integers
    • Decimal representation of given binary string is divisible by 5 or not
    • Number of substrings divisible by 8 but not by 3
    • To check divisibility of any large number by 999
    • Multiply Large Numbers represented as Strings
    • Divide large number represented as string
    • Remainder with 7 for large numbers
    • Given two numbers as strings, find if one is a power of other
    • Check whether a given number is even or odd
    • Product of nodes at k-th level in a tree represented as string
    • Program to find remainder when large number is divided by 11
    • Ways to remove one element from a binary string so that XOR becomes zero
    • Find the maximum subarray XOR in a given array
    • Calculate the difficulty of a sentence
    • Minimum Index Sum for Common Elements of Two Lists

Mathematical Implementation of Algorithms

  • GCD and LCM
  • Prime Factorization and Divisors
  • Fibonacci Numbers
  • Catalan Numbers
  • Modular Arithmetic
  • Euler Totient Function
  • nCr Computations
  • Set Theory
  • Chinese Remainder Theorem
  • Factorial
  • Prime numbers and Primality Tests
  • Sieve Algorithms
  • Divisibility and Large Numbers
  • Series
  • Number Digits
  • Triangles
  • Algebra
  • Number System

Greedy Algorithms Implementation

Standard Greedy Algorithms

  1. Activity Selection Problem
  2. Egyptian Fraction
  3. Job Sequencing Problem
  4. Job Sequencing Problem (Using Disjoint Set)
  5. Job Sequencing Problem – Loss Minimization
  6. Job Selection Problem – Loss Minimization Strategy | Set 2
  7. Huffman Coding
  8. Efficient Huffman Coding for sorted input
  9. Huffman Decoding
  10. Water Connection Problem
  11. Policemen catch thieves
  12. Minimum Swaps for Bracket Balancing
  13. Fitting Shelves Problem
  14. Assign Mice to Holes

Implementation of the above is required in any language of your choice as logic only matters.

Can I Vote

Here you need to create a kotlin program where User will insert their Age in Int and you need to check whether that person can Vote or not.
Minimum age is 18.

Create a algorithm to calculate tax from income tax slabs.

User will give you the number of slabs in income tax layer and amount of tax to be charged (mean to say these values are variable).
Create a program to implement these and also given the same inputs you have to calculate the salary from the tax paid.

You can break this program into parts to solve. But should be under one file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.