Algorithms Tutorial Improve Improve Like Article Like Save Share Report This “Algorithms Tutorial” is like a helpful guide for people who want to get better at solving problems and thinking logically. It covers the basic ideas of algorithms, like how to create them, analyze them, and make them work better. By using this tutorial, you can learn smart ways to solve tricky problems, make your algorithms work faster, and boost your programming skills. Table of Content What is an Algorithm? Characteristics of an Algorithm Properties of an Algorithm Advantages of Algorithms Disadvantages of Algorithms Introduction to Algorithms Analysis of Algorithms Searching and Sorting Greedy Algorithms Dynamic Programming Pattern Searching Backtracking Divide and Conquer Geometric Algorithm Mathematical Algorithms Bitwise Algorithms Graph Algorithms Randomized Algorithms Branch and Bound Quizzes What is an Algorithm? The word Algorithm means “A set of rules to be followed in calculations or other problem-solving operations” Or “A procedure for solving a mathematical problem in a finite number of steps“. An algorithm is a step-by-step procedure to solve a problem. A good algorithm should be optimized in terms of time and space. Different types of problems require different types of algorithmic techniques to be solved in the most optimized manner. Characteristics of an Algorithm: An algorithm must have the following characteristics: Clear and Unambiguous: The algorithm should be unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning. Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs. It may or may not take input. Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well. It should produce at least 1 output. Finite-ness: The algorithm must be finite, i.e. it should terminate after a finite time. Feasible: The algorithm must be simple, generic, and practical, such that it can be executed with the available resources. It must not contain some future technology or anything. Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected. Properties of an Algorithm: It should terminate after a finite time. It should produce at least one output. It should take zero or more input. It should be deterministic means giving the same output for the same input case. Every step in the algorithm must be effective i.e. every step should do some work. Advantages of Algorithms: It is easy to understand. An algorithm is a step-wise representation of a solution to a given problem. In an Algorithm the problem is broken down into smaller pieces or steps hence, it is easier for the programmer to convert it into an actual program. Disadvantages of Algorithms: Writing an algorithm takes a long time so it is time-consuming. Understanding complex logic through algorithms can be very difficult. Branching and Looping statements are difficult to show in Algorithms. Introduction to Algorithms: What is Algorithm | Introduction to Algorithms Definition, Types, Complexity, Examples of Algorithms Algorithms Design Techniques Why is analysis of an Algorithm important? Analysis of Algorithms: Asymptotic Analysis Worst, Average and Best Cases Asymptotic Notations Lower and Upper Bound Theory Introduction to Amortized Analysis What does ‘Space Complexity’ mean? Polynomial Time Approximation Scheme Accounting Method | Amortized Analysis Potential Method in Amortized Analysis Searching and Sorting: Introduction to Searching Algorithms Introduction to Sorting Algorithm Stable and Unstable Sorting Algorithms Lower bound for comparison based sorting algorithms Can Run Time Complexity of a comparison-based sorting algorithm be less than N logN? Which sorting algorithm makes minimum number of memory writes? Greedy Algorithms: Introduction to Greedy Algorithms Activity Selection Problem Huffman Coding Job Sequencing Problem Quiz on Greedy Algorithms Minimum Number of Platforms Required for a Railway/Bus Station Dynamic Programming: Introduction to Dynamic Programming Overlapping Subproblems Property Optimal Substructure Property Longest Increasing Subsequence Longest Common Subsequence Min Cost Path Coin Change Matrix Chain Multiplication 0-1 Knapsack Problem Longest Palindromic Subsequence Palindrome Partitioning Pattern Searching: Introduction to Pattern Searching Naive Pattern Searching KMP Algorithm Rabin-Karp Algorithm Pattern Searching using a Trie of all Suffixes Aho-Corasick Algorithm for Pattern Searching Z algorithm (Linear time pattern searching Algorithm) Backtracking: Introduction to Backtracking Print all permutations of a given string The Knight’s tour problem Rat in a Maze N Queen Problem Subset Sum m Coloring Problem Hamiltonian Cycle Sudoku Divide and Conquer: Introduction to Divide and Conquer Merge Sort Write your own pow(x, n) to calculate x*n Count Inversions Closest Pair of Points Strassen’s Matrix Multiplication Geometric Algorithm: Introduction to Geometric Algorithms Closest Pair of Points | O(nlogn) Implementation How to check if a given point lies inside or outside a polygon? How to check if two given line segments intersect? Given n line segments, find if any two segments intersect How to check if given four points form a square Convex Hull using Jarvis’ Algorithm or Wrapping Mathematical Algorithms: Introduction to Mathematical Algorithms Write an Efficient Method to Check if a Number is Multiple of 3 Write a program to add two numbers in base 14 Program for Fibonacci numbers Average of a stream of numbers Multiply two integers without using multiplication, division and bitwise operators, and no loops Babylonian method for square root Sieve of Eratosthenes Pascal’s Triangle Given a number, find the next smallest palindrome Program to add two polynomials Multiply two polynomials Count trailing zeroes in factorial of a number Bitwise Algorithms: Introduction to Bitwise Algorithms Little and Big Endian Detect opposite signs Swap bits Turn off the rightmost set bit Rotate bits Next higher number with same number of set bits Swap two nibbles in a byte Graph Algorithms: Introduction to Graph Algorithms BFS, DFS Cycles in Graph Shortest paths MST Topological Sorting Connectivity Max Flow Randomized Algorithms: Introduction to Randomized Algorithms Linearity of Expectation Expected Number of Trials until Success Randomized Algorithms | Set 0 (Mathematical Background) Randomized Algorithms | Set 1 (Introduction and Analysis) Randomized Algorithms | Set 2 (Classification and Applications) Randomized Algorithms | Set 3 (1/2 Approximate Median) Reservoir Sampling Branch and Bound: Branch and Bound | Set 1 (Introduction with 0/1 Knapsack) Branch and Bound | Set 2 (Implementation of 0/1 Knapsack) Branch and Bound | Set 3 (8 puzzle Problem) Branch And Bound | Set 4 (Job Assignment Problem) Branch and Bound | Set 5 (N Queen Problem) Branch And Bound | Set 6 (Traveling Salesman Problem) Quizzes: Analysis of Algorithms Sorting Divide and Conquer Greedy Algorithms Dynamic Programming Backtracking NP Complete Searching Recursion Bit Algorithms Last Updated : 29 Mar, 2024 Like Article Save Article Previous Branch and Bound Algorithm Next Competitive Programming - A Complete Guide Share your thoughts in the comments Add Your Comment Please Login to comment...