Search for question
Question

Design, implement and test an object-oriented program that defines Signle_Linked_List class which has two sub classes Stack and Queue. For the Stack class, define a constructor, push and pop methods.

For the Queue class, define a constructor, enqueue and dequeue methods. The push method should make use of the method "insert_at_head(value)" that belongs to the Signle_Linked_List class and the pop method should make use of the method remove_at_head()"that belongs to the Signle_Linked_List class. Similarly, the enqueue method should make use of the method "insert_at_tail(value)" that belongs to the Signle_Linked_List class, and the dequeue method should make use of the method remove_at_head()" that belongs to the Signle_Linked_List class.

Fig: 1