Algorithms and problems every programmer should know

Algorithms and problems every programmer should know

Sorting Algorithms

200.webp A Sorting Algorithm is used to rearrange a given array or list elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of elements in the respective data structure.

  • Bubble sort
  • Insertion sort
  • Quick sort
  • Merge sort
  • Heap sort
  • Counting sort

Searching algorithms

200 (1).webp Searching Algorithms are designed to check for an element or retrieve an element from any data structure where it is stored.

  • Linear search
  • Binary search (with all its variants)
  • Breadth-first search (BFS)
  • Depth-first search (DFS)

Array algorithms

200 (2).webp Array is a container that can hold a fixed number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array.

Element − Each item stored in an array is called an element.

Index − Each location of an element in an array has a numerical index, which is used to identify the element.

  • Kadane's algorithm
  • Floyd cycle detection algorithm
  • KMP algorithm
  • Quick select algorithm

Stack

stack.png Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out).

  • Tower of Hanoi problem
  • Infix to postfix conversion
  • Parenthesis matching

Tree and Heap algorithms

150px-Heap_add_step1.svg.png A Heap is a special Tree-based data structure in which the tree is a complete binary tree.

  • Creation of heap
  • Implementation of Priority queue
  • Traversals - preorder, inorder, postorder

Graph algorithms

undirectedgraph.png A Graph is a non-linear data structure consisting of nodes and edges. The nodes are sometimes also referred to as vertices and the edges are lines or arcs that connect any two nodes in the graph. More formally a Graph can be defined as,

A Graph consists of a finite set of vertices(or nodes) and a set of Edges that connect a pair of nodes.

  • Kruskal's algorithm
  • Prim's algorithm
  • Dijkstra's algorithm
  • Bellman ford algorithm
  • Topological sort algorithm

Dynamic programming (Recursion+Memoization)

180px-Shortest_path_optimal_substructure.svg.png Memoization is a way to potentially make functions that use recursion run faster. . A memoization function allows us to store input alongside the result of the calculation. Therefore, rather than having to do the same work again using the same input, it can simply return the value stored in the cache.

  • Fibonacci series
  • Longest common subsequence
  • Matrix chain multiplication

Other

200 (3).webp

  • Huffman coding for compression
  • Bit vector
  • Disjoint set data structure (Union find)

If you liked this, make sure to: like and follow