always maintain front and rear pointers, updating them accordingly during insertion and deletion can achieve this in O(1)
surender On Mon, Jul 4, 2011 at 9:59 PM, vaibhav shukla <[email protected]>wrote: > How to implement a QUEUE using a singly link list such that the operations > ENQUEUE and DEQUEUE takes O(1) time ? > > -- > best wishes!! > Vaibhav Shukla > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
