


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Some concept of Data Structures and Algorithm are Permutation, Representation, Implemented, Algorithm Design, Dynamic Programming, Graph Data Structures, String Processing, General Trees. Main points of this lecture are: Stacks, Applications, Implementation, Element, First Out, Real Life, Plate Trays, Execution Stack, Program Execution, Evaluating Expressions
Typology: Slides
1 / 26
This page cannot be seen from the preview
Don't miss anything!



















Boolean isEmpty(stack) ::= if (stack == CreateS(max_stack_size)) return TRUE else return FALSE Element pop(stack) ::= if (IsEmpty(stack)) return else remove and return the item on the top of the stack.
void push(int top, element item) { / add an item to the global stack / if (top >= MAX_STACK_SIZE-1) { stack_full( ); return; } stack[++*top] = item; }
element pop(int top) { / return the top element from the stack / if (top == -1) return stack_empty( ); /* returns and error key / return stack[(top)--]; }
element pop(pnode top) { /* delete an element from the stack */ pnode temp = top; element item; if (IS_EMPTY(temp)) { fprintf(stderr, “The stack is empty\n”); exit(1); } item = temp->item; top = temp->next; free(temp); return item; }