diff --git a/parenthesis checker b/parenthesis checker new file mode 100644 index 00000000..03194133 --- /dev/null +++ b/parenthesis checker @@ -0,0 +1,61 @@ +#include +using namespace std; +#include +#define n 20 +char push(char); +char pop(); +int top=-1; +int stack[20]; +main() +{ + char s[20],temp; + cout<<"enter expression"<>s; + int x=1,i; + for(i=0;i=0) + x=0; + if(x==0) + cout<<"invalid\n"; + else + cout<<"valid\n"; +} +char push(char a) +{ + if(top==n-1) + cout<<"stack overflow"< +#include +#include +using namespace std; +void printSolution(int reach[][4]) +{ + cout<<"Following matrix is transitive closure of the given graph\n"; + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 4; j++) + { + cout<