Queue Using LL

 You need to implement a Queue class using linked list.

All the required data members should be private.

Implement the following public functions :

1. Constructor -

Initialises the data members.

2. enqueue :

This function should take one argument of type T and has return type void. This function should insert an element in the queue. Time complexity should be O(1).

3. dequeue :

This function takes no input arguments and has return type T. This should removes the first element which is entered and return that element as an answer. Time complexity should be O(1).

4. front :

This function takes no input arguments and has return type T. This should return the first element which is entered and return that element as an answer. Time complexity should be O(1).

5. size :

Return the size of stack i.e. count of elements which are present ins stack right now. Time complexity should be O(1).

6. isEmpty :

Checks if the queue is empty or not. Return true or false.

Comments

Popular posts from this blog

MySQL Multi Source Master Slave Replication using GTID

Access and modify all the resources of our Wiki.js using WikiJS API

How to pass parameters in webhook?