Write pseudo code for push in a stack?

Answer Posted / surya8273@gmail.com

push means inserting an element on to the top of the stack.
lets define array of size 10,
int a[10]
Top<== -1 // stack is empty now.
Push(x)// x is a element to be push.lets take x=4
{
top<== top+1
// top will initialize to 1,now the top will be address to the 0 th index of array.//
a[Top]<== x
// insert x in to the 0th index of array(a[0]<== 4)//
}

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

officer say me - i am offered to a smoking , then what can you say

1576


What is interface? When and where is it used?

1660


What is destructor oops?

615


What is class in oop with example?

611


What is the use of oops?

615






What are the 5 oop principles?

594


any one please tell me the purpose of operator overloading

1962


What is the main feature of oop?

616


What is the main purpose of inheritance law?

666


What is the oops and benefits of oops programming?

549


What is balance factor?

579


Can main method override?

580


What is polymorphism programming?

598


Can enum be null?

582


Why do while loop is used?

570