SkillAgentSearch skills...

Algorithms

Algorithms in python and C

Install / Use

/learn @hansrajdas/Algorithms

README

List of Algorithms

All programs are categorized in level 1 to 4 (1 being easiest)

Sorting

Trie

Graphs

  • DFS traversal: Create a directed graph and performs depth first search(DFS) traversal | O(V + E) | Level 2.
  • BFS traversal: Breadth first search(BFS) traversal of directed graph | O(V + E) | Level 2.
  • Connected components: Find all connected components in a graph | O(V + E) | Level 2.
  • Shortest path in unweighted graph: Find shortest path from src to dst in an unweighted graph | O(V + E) | Level 2.
  • Cycle in graph: Check if there is cycle in a directed graph, uses DFS | O(V + E) | Level 3.
  • Topological sort: Topological order of directed acyclic graph (DAG) using DFS | O(V + E) | Level 3.
  • Topological sort (Kahn's algo): Topological order of directed acyclic graph (DAG) using Kahn's algorithm | O(V + E) | Level 3.
  • Shortest path of DAG: Find shortest in a directed acyclic graph from a source vertex to all reachable vertex | O(V + E) | Level 3.
  • Dijkstras shortest path: Implement Dijkstras shortest path algo | O(E * log(V)) | Level 3.
  • Bellman ford: Bellman ford algo to find shortest path in a graph | O(VE) | Level 3.
  • Triagles in graph: Given a graph(directed or undirected), count the number of triagles present | O(N^3) | Level 2.

Union find(disjoint sets)

Square root decomposition

Segment tree

  • Segment Tree - Python: Implement segment tree (iterative approach) in Python | O(logn) | Level 3.
  • Segment Tree - Go: Implement segment tree (iterative approach) in Golang | O(logn) | Level 3.

Binary indexed (Fenwick) tree

Cracking the coding interview(6th edition)

1. Arrays and strings

2. Linked list

3. Stacks and queues

  • Skipped code, mostly theoritical/design questions

4. Trees and graphs

  • Route between 2 nodes: Given a directed graph, check if there is a route b/w 2 nodes | O(V + E) | Level 2.
  • Sorted array to BST: Given a sorted array, create binary search tree(BST) with minimal height | O(N) | Level 3.
  • List of depths: Binary tree to linked list for each level | O(N) | Level 2.
  • Is tree balanced: Check if a binary tree is balanced | O(N) | Level 2.
  • Is BST valid: Check if a tree is valid BST or not | O(N) | Level 3.
  • BST inorder successor: Find inorder successor of a node in binary search tree | O(h) | Level 2.
  • Project build order: Given projects and there dependent projects, find build order. Graph topological sort problem | O(P + D) | Level 2.
  • [

Related Skills

View on GitHub
GitHub Stars82
CategoryDevelopment
Updated8mo ago
Forks39

Languages

Python

Security Score

77/100

Audited on Jul 24, 2025

No findings