Introduction to Algorithms
The word Algorithm means ”A set of finite rules or instructions to be followed in calculations or other problem-solving operations” Or ”A procedure for solving a mathematical problem in a finite number of steps that frequently involves recursive operations”.
There are many important algorithms that are commonly covered in technical interviews. Here is a list of some common algorithms that you might be expected to know:
- Sorting algorithms: algorithms for sorting a list of items, such as
bubble sort
,insertion sort
,merge sort
, andquick sort
. - Search algorithms: algorithms for searching a list of items, such as
linear search
,binary search
, andternary search
. - Graph algorithms: algorithms for working with graphs, such as
Depth-First Search (DFS)
,Breadth-First Search (BFS)
, and shortest path algorithms (e.g.,Dijkstra's algorithm
andA*
). - Tree algorithms: algorithms for working with trees, such as tree traversal algorithms and algorithms for maintaining binary search trees.
- Dynamic programming: algorithms for solving problems by breaking them down into smaller subproblems and storing the results to avoid unnecessary recomputation.
- Divide and conquer: algorithms for solving problems by dividing them into smaller subproblems and solving each subproblem separately.
- Greedy algorithms: algorithms for making locally optimal choices at each step in order to try to achieve a global optimal solution.
- String matching algorithms: algorithms for finding patterns in strings, such as the
Knuth-Morris-Pratt (KMP)
algorithm and theBoyer-Moore algorithm
. - Hashing algorithms: algorithms for mapping keys to indices in a hash table, such as
linear probing
andseparate chaining
. - NP-hard problems: understanding of the concept of NP-hard problems and techniques for solving them, such as
approximation algorithms
andheuristics
.
It's also helpful to be familiar with various data structures, such as arrays
, linked lists
, stacks
, queues
, and heaps
, and how to use them to implement algorithms efficiently.
Types of Algorithms
- Brute Force Algorithm
- Recursive Algorithm
- Backtracking Algorithm
- Searching Algorithm
- Sorting Algorithm
- Hashing Algorithm
- Divide and Conquer Algorithm
- Greedy Algorithm
- Dynamic Programming Algorithm
- Randomized Algorithm
Algorithm complexity
- Space Complexity
- Time Complexity