top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Consider a linked list implemented of a queue with two pointers: front and rear.

+2 votes
88 views

What is the order of inserting an element if the queue is of length n?

posted Sep 27, 2013 by Vivek Singh

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

2 Answers

0 votes

Few cases -
1. If it is ordered list, we can apply the binary search and insert an element o(log n).
2. If it is unordered then we can insert at whatever place we want i.e. o(1).

answer Sep 27, 2013 by Salil Agrawal
0 votes

It is of order O(1),when we insert element from rear end.

answer Sep 28, 2013 by Manish Negi
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...