Question: You are to write three separate programs, one each for stacks, queues, and linked-lists that broadly support adding, deleting and displaying data. Each of your
You are to write three separate programs, one each for stacks, queues, and linked-lists that broadly support adding, deleting and displaying data. Each of your program should include a class definition for "chunk", a class definition for the data structure (stack/queue/LL) as well as a main() function that should give a "menu" like interface to call the various functions. This "menu" like interface can be easily acheived with a "while(1)" loop and a "switch" statement nested within it, like we did in the Stack example during lecture. Functions required for each data structure: Linked list: - void insertAtHead(int value) Hint: Similar to Stacks, insert at position 1 - void insertAtPosition(int position, int value) Hint: This should insert a node with value at any position in the list as long as that position is valid - void removeFromPosition(int position) Hint: Similar to insert above, this should remove a node from a list as long as position is valid - void displayContents() Stacks: - void push(int value) - void pop() - void displayContents() Queues: - void enqueue(int value) - void dequeue() - void displayContents()
PLEASE WRITE IN CPP THANK YOI
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
