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

This quiz was taken in class of Data Structure course by Shekhar Sharma at B R Ambedkar National Institute of Technology. It includes: Dynamic, Class, Stack, Implement, Functions, Push, Adjust, Pointers, Structure, Node, Protected

Typology: Exercises

2011/2012

Uploaded on 07/11/2012

dharanidhar
dharanidhar 🇮🇳

4.2

(6)

58 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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