Repository for data structure and algorithms in Python for coding interviews

Overview

logo

Python Data Structures and Algorithms

This repository contains questions requiring implementation of data structures and algorithms concepts. It is useful for interviews in Python.

? Objective

The open source community has helped me a lot during my interview preparations and studies while I was in my undergrad. I always wanted to give something back to the community. In my endeavour to contribute something back, I will be uploading data structures and algorithms questions in Python in this repo. Feel free to contribute and get in touch! ?

? Structure of the repository

As of now, the repository contains 3 main directories: Bookmarks, Data Structures and Algorithms.

Data Structures

Contains all data structure questions categorised into sub-directories like stack, queue, etc according to their type.

  1. Array
  2. Dictionary
  3. Binary Search Tree
  4. Linked List
  5. Stack
  6. Graphs
  7. Circular Linked List
  8. Doubly Linked List

Algorithms

This directory contains various types of algorithm questions like Dynamic Programming, Sorting, Greedy, etc. The current structure of this directory is like -

  1. Dynamic Programming
  2. Graphs
  3. Greedy
  4. Math
  5. Misc
  6. Sorting
  7. Bit Manipulation

Bookmarks

You can find useful links in this repository in the different markdown files. Below is a table of contents.

Category Link
Articles Click Here
Books Click Here
Topics Click Here
Tutorials Click Here
Videos Click Here
Misc. Click Here

? Things need to be done

As you can see, the repo is still in its infancy. Here are some key things in the to-do.

  1. Queue questions
  2. Algorithms
  3. More questions in data structures, especially for graph, circular linked list, trees, heaps and hash.

Contributing

Contributions are always welcomed. ? Feel free to raise new issues, file new PRs. Consider giving it a star and fork this repo! ?

To follow the guidelines, refer to Contributing.md

? License

MIT

Comments
  • Create a logo for the repository's readme

    Create a logo for the repository's readme

    The readme will look better with a logo. We just need a minimalist and simple logo (only text) with the words python-ds.

    Feel free to file a PR :smiley:

    documentation help wanted good first issue Hacktoberfest design 
    opened by prabhupant 9
  • Create an index.md file for every sub-directory

    Create an index.md file for every sub-directory

    Having an index for every sub-directory will ease navigation around the repository. Here is the structure I think will do good

    - Data Structures
       - array
          - index.md
       - stack
          - index.md
    

    and so on.

    Please feel free to suggest improvements anywhere you feel like and contribute :smiley:

    documentation help wanted good first issue Hacktoberfest 
    opened by prabhupant 6
  • Create mkdocs or readthedocs explaining all data structures

    Create mkdocs or readthedocs explaining all data structures

    This is a big goal and will definitely take months. But if we want this repository to be a single source for interview prep and studying about data structures and algorithms, then having a comprehensive doc about each data structure with its theory like time complexities and use cases will definitely be a great thing.

    I will start working on this in order to give it some direction and momentum.

    Please feel free to suggest any improvements, open issues, point my short comings or contribute :smiley:

    documentation help wanted good first issue Hacktoberfest long-goal 
    opened by prabhupant 5
  • Deque Implementation

    Deque Implementation

    Description

    Added Deque implementation that uses python list. Deque is data structure. Personally me, I like it very much and use it often. It is like stack but has some advantages, you can add elements in both sides, as in back, also in front. I think it's very useful data structure.

    Please include a summary of the change and which issue is fixed or what question/feature you have added.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [ ] New feature/question

    Checklist:

    • [ ] My code follows the style guidelines of this project i.e. Pep8
    • [ ] I have performed a self-review of my own code
    opened by shotanozadze 4
  • Adding Kruskal_Minimum_spanning_tree.py

    Adding Kruskal_Minimum_spanning_tree.py

    Description

    Added greedy algorithm

    1. Sort all the edges in non-decreasing order of their weight.
    2. Pick the smallest edge. Check if it forms a cycle with the spanning tree formed so far. If cycle is not formed, include this edge. Else, discard it.
    3. Repeat step#2 until there are (V-1) edges in the spanning tree. Fixes # (issue) None

    Type of change

    Code Addition

    Please delete options that are not relevant.

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature/question
    • [ ] This change requires a documentation update
    • [ ] Bookmark link

    Checklist:

    • [ ] My code follows the style guidelines of this project i.e. Pep8
    • [x] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] I have made corresponding changes to the documentation
    • [ ] Any dependent changes have been merged and published in downstream modules
    • [ ] I have squashed unnecessary commits
    opened by whitehawk0011 4
  • min_product fix

    min_product fix

    Description

    min_product was broken - variable name mismatch - fixed it.

    Fixes # (issue)

    There was a variable name mismatch. count_negative should have been used instead of count_neg. Removed an unused variable. Also fixes one of the lint checks.

    Type of change

    • [x] Bug fix (non-breaking change which fixes an issue)

    Checklist:

    • [x] My code follows the style guidelines of this project i.e. Pep8
    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] Any dependent changes have been merged and published in downstream modules
    • [x] I have squashed unnecessary commits
    opened by Harshal96 3
  • Added a question in dynamic programming

    Added a question in dynamic programming

    Description

    Added a new Dynamic Programming quesion.

    Fixes #279

    Type of change

    Please delete options that are not relevant.

    • [x] New feature/question

    Checklist:

    • [x] My code follows the style guidelines of this project i.e. Pep8
    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] Any dependent changes have been merged and published in downstream modules
    • [x] I have squashed unnecessary commits
    opened by imehar 3
  • middle_element.py

    middle_element.py

    middle element by swapnil

    Description

    Please include a summary of the change and which issue is fixed or what question/feature you have added.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature/question
    • [ ] This change requires a documentation update
    • [ ] Bookmark link

    Checklist:

    • [x] My code follows the style guidelines of this project i.e. Pep8
    • [ ] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] I have made corresponding changes to the documentation
    • [ ] Any dependent changes have been merged and published in downstream modules
    • [ ] I have squashed unnecessary commits
    opened by swapnil112 3
  • Gnome sort

    Gnome sort

    Description

    Please include a summary of the change and which issue is fixed or what question/feature you have added.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [x] New feature/question

    Checklist:

    • [x] My code follows the style guidelines of this project i.e. Pep8
    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] I have squashed unnecessary commits
    opened by Hyde46 3
  • implement gnome sort algorithm

    implement gnome sort algorithm

    Description

    implement gnome sort algorithm with examples.

    Fixes #361

    Please delete options that are not relevant. [ ] New feature/question

    Checklist:

    • [x] My code follows the style guidelines of this project i.e. Pep8
    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] I have made corresponding changes to the documentation
    • [x] Any dependent changes have been merged and published in downstream modules
    • [x] I have squashed unnecessary commits
    opened by beqakd 2
  • division factors

    division factors

    Description

    Natural number divisors and prime factors.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [ ] New feature/question
    • [ ] Bookmark link

    Checklist:

    • [ ] My code follows the style guidelines of this project i.e. Pep8
    • [ ] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] I have made corresponding changes to the documentation
    • [ ] Any dependent changes have been merged and published in downstream modules
    • [ ] I have squashed unnecessary commits
    opened by shotanozadze 2
  • An alternate way without using sys module

    An alternate way without using sys module

    Description

    Most online compilers do not support the sys module which is the reason I have added an alternate way to solve this question. #Hacktoberfest

    opened by Tiagupt03 0
  • Created next_highest_pow_2.py

    Created next_highest_pow_2.py

    Description

    Please include a summary of the change and which issue is fixed or what question/feature you have added.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [x] New feature/question

    Checklist:

    • [x] I have performed a self-review of my own code
    opened by rayavarapuvikram1 0
  • Added Rabin_karp Algorithm

    Added Rabin_karp Algorithm

    Description

    Added Python Program -> Rabin-Karp Algorithm for Pattern Searching in data_structures/strings

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [x] New feature/question

    Checklist:

    • [x] My code follows the style guidelines of this project i.e. Pep8
    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] I have made corresponding changes to the documentation
    • [x] Any dependent changes have been merged and published in downstream modules
    • [x] I have squashed unnecessary commits
    opened by codingis4noobs2 0
  • docs: Fix a few typos

    docs: Fix a few typos

    There are small typos in:

    • data_structures/array/all_numbers_divisible.py
    • data_structures/array/index.md
    • data_structures/binary_trees/children_sum_property.py
    • data_structures/graphs/cycle_in_directed_graph_using_colors.py
    • data_structures/graphs/cycle_in_directed_graph_using_colors_recursive.py
    • data_structures/graphs/dag_longest_path.py
    • data_structures/heap/max_heap.py
    • data_structures/strings/KMP_Pattern_Search.py

    Fixes:

    • Should read initial rather than inital.
    • Should read equal rather than eqaul.
    • Should read satisfies rather than statisfies.
    • Should read divisible rather than divisble.
    • Should read comparison rather than comparision.
    • Should read children rather than childen.
    • Should read calculate rather than caluclate.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 0
  • add test for coin change function

    add test for coin change function

    Description

    Please include a summary of the change and which issue is fixed or what question/feature you have added.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature/question
    • [ ] This change requires a documentation update
    • [ ] Bookmark link

    Checklist:

    • [x] My code follows the style guidelines of this project i.e. Pep8
    • [x] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] I have made corresponding changes to the documentation
    • [ ] Any dependent changes have been merged and published in downstream modules
    • [ ] I have squashed unnecessary commits
    opened by tranlinh19021320 1
Owner
Prabhu Pant
Hacker | Thinker
Prabhu Pant
Genetic algorithms are heuristic search algorithms inspired by the process that supports the evolution of life.

Genetic algorithms are heuristic search algorithms inspired by the process that supports the evolution of life. The algorithm is designed to replicate the natural selection process to carry generation, i.e. survival of the fittest of beings.

Mahdi Hassanzadeh 4 Dec 24, 2022
🌟 Python algorithm team note for programming competition or coding test

?? Python algorithm team note for programming competition or coding test

Seung Hoon Lee 3 Feb 25, 2022
Repository for Comparison based sorting algorithms in python

Repository for Comparison based sorting algorithms in python. This was implemented for project one submission for ITCS 6114 Data Structures and Algorithms under the guidance of Dr. Dewan at the University of North Carolina at Charlotte, Fall 2021.

Devashri Khagesh Gadgil 1 Dec 20, 2021
This is the code repository for 40 Algorithms Every Programmer Should Know , published by Packt.

40 Algorithms Every Programmer Should Know, published by Packt

Packt 721 Jan 2, 2023
Minimal examples of data structures and algorithms in Python

Pythonic Data Structures and Algorithms Minimal and clean example implementations of data structures and algorithms in Python 3. Contributing Thanks f

Keon 22k Jan 9, 2023
:computer: Data Structures and Algorithms in Python

Algorithms in Python Implementations of a few algorithms and datastructures for fun and profit! Completed Karatsuba Multiplication Basic Sorting Rabin

Prakhar Srivastav 2.9k Jan 1, 2023
Python Client for Algorithmia Algorithms and Data API

Algorithmia Common Library (python) Python client library for accessing the Algorithmia API For API documentation, see the PythonDocs Algorithm Develo

Algorithmia 138 Oct 26, 2022
Algorithms and data structures for educational, demonstrational and experimental purposes.

Algorithms and Data Structures (ands) Introduction This project was created for personal use mostly while studying for an exam (starting in the month

null 50 Dec 6, 2022
Planning Algorithms in AI and Robotics. MSc course at Skoltech Data Science program

Planning Algorithms in AI and Robotics course T2 2021-22 The Planning Algorithms in AI and Robotics course at Skoltech, MS in Data Science, during T2,

Mobile Robotics Lab. at Skoltech 6 Sep 21, 2022
Cormen-Lib - An academic tool for data structures and algorithms courses

The Cormen-lib module is an insular data structures and algorithms library based on the Thomas H. Cormen's Introduction to Algorithms Third Edition. This library was made specifically for administering and grading assignments related to data structure and algorithms in computer science.

Cormen Lib 12 Aug 18, 2022
Code for generating alloy / disordered structures through the special quasirandom structure (SQS) algorithm

Code for generating alloy / disordered structures through the special quasirandom structure (SQS) algorithm

Bruno Focassio 1 Nov 10, 2021
Algorithms-in-Python - Programs related to DSA in Python for placement practice

Algorithms-in-Python Programs related to DSA in Python for placement practice CO

MAINAK CHAUDHURI 2 Feb 2, 2022
All Algorithms implemented in Python

The Algorithms - Python All algorithms implemented in Python (for education) These implementations are for learning purposes only. Therefore they may

The Algorithms 150.6k Jan 3, 2023
Algorithms implemented in Python

Python Algorithms Library Laurent Luce Description The purpose of this library is to help you with common algorithms like: A* path finding. String Mat

Laurent Luce 264 Dec 6, 2022
A command line tool for memorizing algorithms in Python by typing them.

Algo Drills A command line tool for memorizing algorithms in Python by typing them. In alpha and things will change. How it works Type out an algorith

Travis Jungroth 43 Dec 2, 2022
Python sample codes for robotics algorithms.

PythonRobotics Python codes for robotics algorithm. Table of Contents What is this? Requirements Documentation How to use Localization Extended Kalman

Atsushi Sakai 17.2k Jan 1, 2023
🧬 Performant Evolutionary Algorithms For Python with Ray support

?? Performant Evolutionary Algorithms For Python with Ray support

Nathan 49 Oct 20, 2022
All algorithms implemented in Python for education

The Algorithms - Python All algorithms implemented in Python - for education Implementations are for learning purposes only. As they may be less effic

null 1 Oct 20, 2021
Implementation of Apriori algorithms via Python

Installing run bellow command for installing all packages pip install -r requirements.txt Data Put csv data under this directory "infrastructure/data

Mahdi Rezaei 0 Jul 25, 2022