Docsity

Dynamic Stack Class 1-Programming Data Structures-Quiz, Exercises of Data Structures and Algorithms

Toggle sidebar
bg1
CS2143-2144 Data Structures Spring 2012
Quiz # 8. (19 April 2012)
Time 10 Minutes
Max. Marks 10
Name: Reg. No: ___
For the following dynamic stack class, implement the following functions. Assume all
other functions given in the class have already been implemented.
void push (int x) // push a value onto the stack and adjust pointers accordingly
class dStack
{ protected:
struct node
{
int item;
node *prev;
}
node *top;
node *get_node();
void free_node(node *);
public:
dStack();
void push (int x);
int pop ();
};
Docsity.com

Partial preview of the text

Download Dynamic Stack Class 1-Programming Data Structures-Quiz and more Exercises Data Structures and Algorithms in PDF only on Docsity!

CS2143-2144 Data Structures Spring 2012

Quiz # 8. (19 April 2012)

Time 10 Minutes

Max. Marks 10

Name: Reg. No: ___

For the following dynamic stack class , implement the following functions. Assume all

other functions given in the class have already been implemented.

void push (int x) // push a value onto the stack and adjust pointers accordingly class dStack { protected: struct node { int item; node *prev; } node *top; node *get_node(); void free_node(node *); public: dStack(); void push (int x); int pop (); };

Docsity.com