be wasted and in case we allocate less memory locations for queue that might end up growing large and largethen lot of re-allocations will have to be donethereby creating lot of overhead and consuming lot of time in case the queue is very small one or its maximum size is known in advancethen the array implementation of the queue gives an efficient implementation but if the array size cannot be determined in advancethe other alternativei the linked representation is used the storage requirement of linked representation of queue with elements is (nand the typical time requirement for operations is ( in linked queueevery element has two partsone that stores the data and another that stores the address of the next element the start pointer of the linked list is used as front herewe will also use another pointer called rearwhich will store the address of the last element in the queue all insertions will be done at the rear end and all the deletions will be done at the front end if front rear nullthen it indicates that the queue is empty the linked representation of queue is shown in fig operations on linked queues queue has two basic operationsinsert and delete the insert operation adds an element to the end of the queueand the delete operation removes an element from the front or the start of the queue apart from thisthere is another operation peek which returns the value of the first element of the queue insert operation the insert operation is used to insert an element into queue the new element is added as the last element of the queue consider the linked queue shown in fig to insert an element with value we first check if front=null if the condition holdsthen front rear the queue is empty sowe allocate memory for figure linked queue new nodestore the value in its data part and null in its next part the new node will then be called both front and rear howeverif front front rear !nullthen we will insert the new node at the figure linked queue rear end of the linked queue and name this new node as rear thusthe updated queue becomes as shown in fig front rear figure shows the algorithm to insert figure linked queue after inserting new node an element in linked queue in step the memory is allocated for the new node in step step allocate memory for the new node and name the data part of the new node is initialized it as ptr with the value to be stored in the node in step step set ptr -data val step if front null we check if the new node is the first node set front rear ptr of the linked queue this is done by checking set front -next rear -next null if front null if this is the casethen the new else set rear -next ptr node is tagged as front as well as rear also null set rear ptr is stored in the next part of the node (which is set rear -next null also the front and the rear nodehoweverif [end of ifstep end the new node is not the first node in the listthen it is added at the rear end of the linked queue figure algorithm to insert an element in linked queue (or the last node of the queue