Tag Archives: algorithm

Evaluation of postfix expression algorithm using stacks

Algorithm for Evaluation of postfix expression

Postfix expression also known as   Reverse Polish notation (RPN) is a mathematical notation in which every operator follows all of its operands, in contrast to Polish notation (PN), which puts the operator before its operands. It is also known as postfix notation. It does not need any parentheses as long as each operator has a fixed number of operands.

Evaluation of postfix expression
Title – Evaluation of postfix expression

Continue reading Evaluation of postfix expression algorithm using stacks

Finding the length of connected cells backtracking

length of connected cells of 1 s (regions) in an matrix of 0s and 1s .

For a given matrix the elements can be 1s or 0s . The filled cells that are connected form a region. Two cells are said to be connected if they are connected if they are adjacent to each other horizontally, vertically or diagonally . There may be several regions in the matrix. How do you find the largest region (in terms of number of cells) in the matrix ? Continue reading Finding the length of connected cells backtracking

C program for Tower Of Hanoi problem puzzle

Tower Of Hanoi Puzzle

The tower of Hanoi problem is a mathematical puzzle. It consists of three rods (or pegs or towers), and a number of disks of different sizes which can slide on any rod. The problem starts with n plates in a particular rod in ascending order of size, i.e the smallest at the top thus making a conical shape. The goal is to transfer all the plates to another rod, satisfying some conditions. Continue reading C program for Tower Of Hanoi problem puzzle

C program to find gcd using Recursion

GCD (greatest common divisor) / HCF

In mathematics, the greatest common divisor  of two or more integers, when at least one of them is not zero, is the largest positive integer that divides the numbers without a remainder. For example, the gcd of 8 and 12 is 4. Continue reading C program to find gcd using Recursion

Asymptotic Analysis notation in Data Structures

Asymptotic Notation

There are three types of analysis

  • Worst case
  • Best case
  • Average case

In asymptotic analysis the worst case analysis is considered to be the best analysis. To represent these analysis three types of notations are used in complexity analysis. Continue reading Asymptotic Analysis notation in Data Structures

Master Theorem For Divide And Conquer

Master Theorem For Divide And Conquer

Master theorem states that all divide and conquer algorithms divide the problem into sub-problems, each of which is part of the original problem, and then solve each of these sub-problems  to compute the final answer. Continue reading Master Theorem For Divide And Conquer