Question: You have to complete program in this ADT's Node Class ADT class Node { public: dataType data; Node *next; }; Stack Class ADT Class Stack

You have to complete program in this ADT's

You have to complete program in this ADT's Node Class ADT class

Node Class ADT class Node { public: dataType data; Node *next; }; Stack Class ADT Class Stack { public: Node *stackArr; int top; int size; Stack(int); void push(Node*); Node* pop() bool isEmpty(); Linked List Class ADT class List { public: Node *head; List(); void insert_end(dataType); bool isEmpty(); }; Considering the given ADTs, use only the attributes and member functions outlined to create a non-member C++ function Node* reverseList(Node *head) that takes a non-empty list as argument and reverses it by using a stack. The basic algorithm of the function is given as follows: i. Count the number of nodes in the input list. ii. Create a stack of equal size. Push each node of the input list into the stack (one at a time). iv. Create an empty list. Pop all nodes from the stack (one at a time) and attach at the end of the new list, until the stack is empty. vi. Return the head of the reversed list. iii. V

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!