GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
101 views
Which of the following data structure may give overflow error, even though the current number of element in it is less than its size ?

(A) Simple Queue

(B) Circular Queue

(C) Stack

(D) None of these
asked in DS by Junior (725 points) 3 9 | 101 views
simple queue

Both A and B.

In circular queue, if we insert n elements then Rear = Front represents both empty queue and Completely full queue. To avoid ambiguity we declare circular queue full after inserting only N - 1 elements.

2 Answers

0 votes

Simple Queue

As we know the overflow condition of simple queue is 

If (REAR  = MAX) then

Overflow

The linear queue suffers from serious drawback that performing some operations, we can not insert items into queue, even if there is space in the queue. Suppose we have queue of 5 elements and we insert 5 items into queue, and then delete some items, then queue has space, but at that condition we can not insert items into queue.

So A is the answer 

answered by (497 points) 2 9

look at the link u provide..

the memory is utilized more efficient in case of circular queue's.

in cicrcular queue as we can again go back to the first node from the last node ...so we can utilize those vacant places.But in simple queue we cant 

yes. a should be the answer
0 votes
Simple queue because if in simple queue only 1 element is present at last index and then if we try to enqueue then it will give overflow error to avoid thia problm circular queue is introduced.
answered by (411 points) 1 7
But if initially value of front and rear are kept zero in circular queue of size n then the maximum number of elements it can have would be n-1

Related questions

+1 vote
1 answer
1
asked in Computer Networks by jothee Veteran (92.6k points) 975 2337 3116 | 94 views
+1 vote
3 answers
2
asked in Computer Networks by Payal Rastogi Active (1.8k points) 7 50 102 | 123 views
+1 vote
1 answer
3
asked in Computer Networks by Payal Rastogi Active (1.8k points) 7 50 102 | 104 views


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users Oct 2017
  1. Arjun

    23438 Points

  2. Bikram

    17108 Points

  3. Habibkhan

    8344 Points

  4. srestha

    6314 Points

  5. Debashish Deka

    5458 Points

  6. jothee

    5008 Points

  7. Sachin Mittal 1

    4882 Points

  8. joshi_nitish

    4390 Points

  9. sushmita

    3996 Points

  10. Rishi yadav

    3838 Points


Recent Badges

Popular Question sunil sarode
Verified Human nandisrinivas
Nice Question shraddha priya
Popular Question just_bhavana
Famous Question rahul sharma 5
Popular Question Jithin Jayan
Great Answer Sankaranarayanan P.N
Good Question jothee
Great Answer Sankaranarayanan P.N
Famous Question pC
27,346 questions
35,200 answers
84,228 comments
33,327 users