top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+2 votes
568 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 LinkedIn 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
...