Implementation of queue by using a single linked list, Data Structure & Algorithms

Q. Perform implementation of a queue using a singly linked list L. The operations INSER and DELETE should take O (1) time.                                                                           


Implementation of queue by using a singly linked list:

When implement a queue as a single liked list, a queue q consists of a list and two pointers, q.front and the q.rear.

inserting an element is stated below:



p=getnode(); info(p) = x; next(p) = null; if(q.rear == null)

q.front = p;


next(q.rear) = p;

q.rear = p;


deletion is stated below:





printf("queue overflow");



p=q.front; x=info(p); q.front=next(p); if(q.front == null) q.rear = null; freenode(p); return(x);


Posted Date: 7/10/2012 3:53:23 AM | Location : United States

Related Discussions:- Implementation of queue by using a single linked list, Assignment Help, Ask Question on Implementation of queue by using a single linked list, Get Answer, Expert's Help, Implementation of queue by using a single linked list Discussions

Write discussion on Implementation of queue by using a single linked list
Your posts are moderated
Related Questions
This algorithm inputs 3 numbers, every number goes through successive division by 10 until its value is less than 1. An output is produced which comprise the number input and a val

Warnock's Algorithm An interesting approach to the hidden-surface problem was presented by Warnock. His method does not try to decide exactly what is happening in the scene but

Explain binary search with an example

I =PR/12 Numbers of years .Interest rate up to 1yrs . 5.50 up to 5yrs . 6.50 More than 5 yrs . 6.75 design an algorithm based on the above information

Write down the algorithm of quick sort. An algorithm for quick sort: void quicksort ( int a[ ], int lower, int upper ) {  int i ;  if ( upper > lower ) {   i = split ( a,

The simplest implementation of the Dijkstra's algorithm stores vertices of set Q into an ordinary linked list or array, and operation Extract-Min(Q) is just a linear search through

an electrical student designed a circuit in which the impedence in one part of a series circuit is 2+j8 ohms and the impedent is another part of the circuit is 4-j60 ohm mm program

CIRCULARLY LINKED LISTS IMPLEMENTATION A linked list wherein the last element points to the first element is called as CIRCULAR linked list. The chains do not specified first o

Question 1 Describe the following- Well known Sorting Algorithms Divide and Conquer Techniques Question 2 Describe in your own words the different asymptotic func

Q. Explain quick sort? Sort the given array using quick sort method. 24 56 47 35 10 90 82 31