Lab04 - Stacks & Queues

You will need solutions of Lab03 exercises to complete this week exercises.

Exercise 1

Based on an implementation of singly-linked list from last week exercises, implement a stack (of strings) providing basic operations: push, pop, getSize, top, isEmpty, print.
You can use this sample implementation if you wish.
You should write a small program to test all the methods.

Exercise 2

A stack (of strings) can be implemented using an existing singly-linked list data structure, i.e. a stack contains a list as its only data component, which takes care of the detailed list processing.
Complete this implemetation. (You need this singly-linked list to compile the code)

Exercise 3

Implement a queue (of strings) in the same way as the stack in Exercise 2.

Exercise 4

Now that you have implemented Stack and Queue data structures, write a small program to demonstrate your solution to Question 4, Homework 4.