Priority Queue, its types and application

Priority Queue A priority queue is a special type of queue in which each element is associated with a priority and is served according to its priority. If there is a condition when two elements have a same number of a priority then they will be served according to their order. How priority queue is … Read more

Circular Queue: Its Operations enQueue and deQueue

Circular Queue is a linear data structure that follows FIFO (First In First Out) principle. FIFO means item that inserted first in queue will be taken out first. Why Circular queue? There was a limitation in normal Queue that if rear reaches at the end of size of queue and there are some space left … Read more

Queue Data Structure and Its Operations

What is Queue ? The process of inserting an element in the queue is called enqueue, and the process of deleting an element from the queue is called dequeue. For example: At Bus Stop, People is in queue and waiting for a bus. The person who is standing in the line at the first position … Read more

Types of Recursion with Example

Recursion is a process in which a function calls itself again and again. We use recursion to solve bigger problem by dividing it into smaller similar sub-problems and then call them recursively. Types of Recursion Recursive functions can be classified on the basis of a) Based on functions call itself – Direct / Indirectb) Based … Read more

Recursion, its principle with an example

Recursion is a process in which a function calls itself again and again. We use recursion to solve the bigger problem by dividing it into smaller similar sub-problems and then call them recursively. In other words, we can also explain it as a problem is broken down into smaller subproblems. And a function applies the … Read more

Algorithm to evaluate a prefix expression

Prefix notation is a notation in which operators are written before their operands. For example, the expressions given are in prefix notation / * A + B C D. Point to consider Permitted operands: A,B,C,D means any real number is permitted. Permitted operators: +,-, *, /, ^(exponentiation) Blanks are permitted in the expression Parenthesis are … Read more

Algorithm to evaluate a postfix expression

In Postfix expression operators are written after their operands. For example, the expressions given are in postfix notation A B C + * D /. Point to consider Permitted operands: A,B,C,D means any real number is permitted. Permitted operators: +,-, *, /, ^(exponentiation) Blanks are permitted in the expression Parenthesis are permitted Prefix and Postfix … Read more

Algorithm to evaluate an infix expression

Generally arithmetic expressions are written in infix expression where the operator is written between the operands. Point to consider Permitted operands: A, B, C, D means any real number is permitted. Permitted operators: +,-, *, /, ^(exponentiation) Blanks are permitted in the expression Parenthesis are permitted Suppose given infix expression is A+B*C-D where A,B,C,D are … Read more

Infix, Prefix and Postfix Expression with example

Infix, Postfix and Prefix notations are the ways of writing and evaluating Arithmetic & Algebraic expressions. Infix, prefix, and postfix are ways to write math expressions. Infix is what we use every day, like 2 + 3. Prefix, also called Polish notation, puts the operator before the numbers, like + 2 3. Postfix, or Reverse … Read more