Implement Queue using Linked List
Algorithm:
- For Enqueue Operation
- Iterate till
node.next = null
- Add new node to node.next
- Iterate till
- For Dequeue Operation
- Remove it from head and
- Update head pointer i.e.
head = head.next
Latest Source Code:
Github: ListQueue.java
Output:
20 10 Dequeue: 10 20 Dequeue: 20