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

What is the difference between procedural programming and oops?

558


What is the difference between a constructor and a destructor?

614


What is destructor give example?

606


What is polymorphism oop?

623


What does and I oop mean in text?

625






class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

1699


What is balance factor?

589


Which is not an object oriented programming language?

544


Can you explain polymorphism?

583


What is polymorphism used for?

574


Can an interface inherit a class?

564


What is new keyword in oops?

593


Why interface is used?

555


What does I oop mean?

618


What polymorphism means?

624