Write pseudo code for push in a stack?

Answers were Sorted based on User's Feedback



Write pseudo code for push in a stack?..

Answer / sanjeevkumar.v

push it mean INSERT the element to the STACK

Is This Answer Correct ?    10 Yes 14 No

Write pseudo code for push in a stack?..

Answer / 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

More OOPS Interview Questions

WHAT IS ABSTRUCT DATA TYPE ? PLEASE EXPLAIN IT.

4 Answers   HCL,


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

0 Answers  


#include <string.h> #include <stdio.h> #include <stdlib.h> #include<conio.h> void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

0 Answers  


What does and I oop and sksksk mean?

0 Answers  


What is encapsulation example?

0 Answers  






#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; wow *b; a.x = 22; b = &a; a.x = 23; cout << b->x; return 0; }

1 Answers  


How long to learn object oriented programming?

0 Answers  


What is the highest level of cohesion?

0 Answers  


What is static modifier?

0 Answers  


what is function overloading..?

4 Answers  


is there any choice in opting subjects like 4 out of 7

0 Answers  


what are the characteristics of oops?

7 Answers   NIIT,


Categories