Monday, December 26, 2022

Introduction & Implementation of Queue using Linked-List

                           

            

                                                  Queue { FIFO - First In First Out}

Enqueue: It is an add operation in java   for arrays it takes 0(1) and in linked list it takes 0(1) time

Dequeue: It is remove operation in java   for arrays it takes 0(n) and in linked list it takes 0(1) time

Peek: It is an peek operation in java  for arrays it takes 0(1) and in linked list it takes 0(1) time


Implementation using Linked List: 

Here the elements are added from the back that is rear and removed from the front 









No comments:

Post a Comment

Queue Implementation using Stacks