Posts

Showing posts from July, 2021

Linked Representation of queues

Image
  Linked Representation of queues We have seen how a queue is created using an array. Although this technique of creating a queue is easy, its drawback is that array must be declared to have some fixed size. the array implementation can not be used for large-scale applications where the queues are implemented. One of the alternatives to array implementation is the linked list implementation of a queue. The storage requirement of linked representation of a queue with n elements is o(n) while the time required for operations is o(1). In a linked queue, each node of the queue consists of two parts i.e. data part and the linked part. Each element of the queue points to its immediate next element in the memory. There are two pointers maintained in the memory in the linked queue, i.e. front pointer and rear pointer. The front pointer contains the address of the starting element of the queue while the rear pointer contains the address of the last element of the queue. Insertion and deleti...