C program to implement stack operations using array

Tuesday, June 5th, 2012  »  Posted By  »  Total 3 Comments

Below is the C program to implement stack operations using array 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 […]

C Program which performs stack operations

Tuesday, June 5th, 2012  »  Posted By  »  Total 1 Comment

Following program performs various stack operations, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 […]

C++ program to implement stack using Linked List

Thursday, February 3rd, 2011  »  Posted By  »  Total 1 Comment

#include <iostream.h> template<class T> class Node { friend LinkedStack<T>; private: T data; Node<T> *link; }; template<class T> class LinkedStack { public: LinkedStack() {top = 0;} ~LinkedStack(); int IsEmpty() const {return top == 0;} T Top() const; LinkedStack<T>& Add(const T& x); LinkedStack<T>& Delete(T& x); private: Node<T> *top; }; template<class T> LinkedStack<T>::~LinkedStack() {// Stack destructor.. Node<T> *next; […]

C++ program to implement Stack using Formula Based Representation

Thursday, February 3rd, 2011  »  Posted By  »  Total 1 Comment

#include<iostream.h> #include<constream.h> template<class T> class Stack { public: Stack(int MaxStackSize); ~Stack(){delete[] S;} int IsEmpty()const{return top==-1;} int IsFull()const{return top==MaxTop;} T Peek()const; void Push(T); T Pop(); void Display(); private: int top; //current top of stack int MaxTop; //max val for top T *S; //element array }; template<class T> Stack<T>::Stack(int MaxStackSize) { //stack constructor MaxTop=MaxStackSize-1; S=new T[MaxStackSize]; top=-1; […]

C++ programs to implement the Stack ADT using an array

Wednesday, March 10th, 2010  »  Posted By  »  Total 11 Comments

void push(int x)
{
if(top > 4)
{
cout <<“stack over flow”;
return;
}
stk[++top]=x;
cout <<“inserted” < }

Java program that implements stack ADT

Friday, October 2nd, 2009  »  Posted By  »  Total 1 Comment

public stack(int s)
{
size=s>0?s:10;
top=-1;
elements=(E[])new Object[size];
}

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup

Email: