HOW TO WRITE ALGORITHM

Best Blogger Tips

>AVAIL LIST: Is a list which contains free node i.e free memory list.

>ALGORITHM: is a written form of program.

>SOFTWARE: Is a collection of programs.

>PROGRAM: is a collection of instructions.

>INSTRUCTION: any order given to computer to perform some task.

=> HOW TO WRITTEN AN ALGORITHM:

>first gave "overflow" and "underflow" condition.

>"OVERFLOW" condition give in push operation.

>"UNDERFLOW" condition give in pop operations.

> At the end of algorithm writes EXIT.

=>ARRAY IMPLEMEMTATION OF STACK:

*(PUSH):

1) IF TOP=MAXSTK then
print " overflow" and exit

2)TOP=TOP+1

3) STACK[TOP]=ITEM

4) EXIT

>TOP is a pointer variable that contains the address of the top element of stack.
>MAXSTK- maximum items the stack can hold.

*(POP):

1) IF TOP=NULL then print " underflow" and exit. ( means stack is empty).

2) ITEM=STACK[TOP] ( means delete item from the top of stack ).

3)TOP=TOP-1

4)EXIT

Kindly Share The Love »»

Save on Delicious

No comments:

Post a Comment