Skip to content

Sajid576/problem-solving-in-python

Repository files navigation

Data-Structure-Algorithms-in-Python

This repository will have many data structures and algorithm implementation in python , simulation and some python templates. Gradually , this repo will contain the solves from leetcode,Geekforgeeks,interviewbit as well. It will also contain system design resources.

Rules:

  1. Anyone can provide any algorithm or data structure implementation. If you want to contribute,firstly you have to fork the repository.Work on that repository then send pull request.Please give a reference that which problem you solved ,which algorithm you implemented or what modifications you have done.

  2. If you want a implementation or any kind help or any questions then you can write that in the issue section.

  3. You can give suggestion in issue section to make the repository better.

  4. You can provide program templates.Such as- Removing duplicates from a list or Counting frequency of numbers in list. Any modified template of algorithms will also be allowed. Such as - Finding Shortest Path using BFS/DFS , Find the node that is unreachable from the source using Dijkstra/BFS/DFS etc . So this kind of implementation will be allowed.

Resources Link

*** List of 75 blind leetcode questions If the pattern of these 75 questions is understood then any interview can be cracked.

Leetcode Patterns

If input array is sorted then

  • Binary search
  • Two pointers

If asked for all permutations/subsets then

  • Backtracking

If given a tree then

  • DFS
  • BFS

If given a graph then

  • DFS
  • BFS

If given a linked list then

  • Two pointers

If recursion is banned then

  • Stack

If must solve in-place then

  • Swap corresponding values
  • Store one or more different values in the same pointer

If asked for maximum/minimum subarray/subset/options then

  • Dynamic programming

If asked for top/least K items then

  • Heap

If asked for common strings then

  • Map
  • Trie

If problem needs to be solved using greedy, then use sort

Else - Map/Set for O(1) time & O(n) space - Sort input for O(nlogn) time and O(1) space

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •