Tag: everest view
-
Postfix Evaluation in C
A complete code block example on Postfix Evaluation in C Data Structures. The following code snippet is complete working C-code on evaluating postfix. I have commented the code for easy understanding. Size of Stack Global declarations Read the postfix expressions Push the operand Operator/pop two operands Invalid Operator Printing the given postfix operations The result…
-
Ackermann Function
Ackermann Function is the simplest example of a well defined total function which is compatible but not primitive recursive. It grows faster than an exponential function. /* Ackermann Function */ #include<stdio.h> #include<stdlib.h> int count = 0, indent = 0; int ackermann(int x, int y) { count++; if(x<0 || y<0) return -1; if(x==0) return y+1; if(y==0)…
-
Infix Expression to Post-fix (Reverse police) Notation
Here we just look out the code on Infix to Postfix expression notation. It is also known as Reverse police method. Find the full code snippet below. Sample Code of Reverse Police Method /* Infix expression to post-fix (Reverse police) notation RabinsXp.com */ #include<stdio.h> #include<ctype.h> #define MAX 100 typedef struct stack { int data[MAX]; int…