Skip to content

A data structures and algorithms repository that holds resources, codes, tips and notes from many sources

Notifications You must be signed in to change notification settings

fixxtion1/dsa-lake

Repository files navigation

DSA-Lake

A data structures and algorithms repository that holds resources, codes, tips and notes from many sources.

Tips

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 and cant use extra space then

  • Fast and slow 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/minumum subarray/subset/options or How many ways then

  • Dynamic programming

If asked for top/least K items then

  • Heap

If asked for common strings then

  • Map
  • Trie

If for a problem there exists a brute force solution in O(n^2) and O(1) space then

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

About

A data structures and algorithms repository that holds resources, codes, tips and notes from many sources

Resources

Stars

Watchers

Forks

Languages