Home » Ask & Discuss » Board Exams - CBSE, ICSE, State Boards » Computer Science « Back to Discussion



Computer Science

Chuck Norris's Avatar
Scorching goIITian

Joined: 25 Nov 2008
Post: 210
23 Mar 2009 18:54:48 IST
0 People liked this
1
1161 View Post
Operations on circular queue ...can someone give a simple /easy to understand program...FAST
None

Operations on circular queue ...can someone give a simple /easy to understand program...FAST


Share this article on:

Comments (1)

Vikram Saxena's Avatar

Forum Expert
Joined: 1 Apr 2007
Posts: 3732
27 Mar 2009 13:03:41 IST
0 people liked this

there can be many operation that can be performed on the circulkat queue just as

1. insertion

2.deletion

 

iam giving u the standard algorithem of the insertion and bdelection

 

Algorithm for Insertion:-
Step-1: If "rear" of the queue is pointing to the last position then go to step-2 or else step-3
Step-2: make the "rear" value as 0
Step-3: increment the "rear" value by one
Step-4:

  1. if the "front" points where "rear" is pointing and the queue holds a not NULL value for it, then its a "queue overflow" state, so quit; else go to step-4.2
  2. insert the new value for the queue position pointed by the "rear"

Algorithm for deletion:-
Step-1: If the queue is empty then say "empty queue" and quit; else continue
Step-2: Delete the "front" element
Step-3: If the "front" is pointing to the last position of the queue then step-4 else step-5
Step-4: Make the "front" point to the first position in the queue and quit
Step-5: Increment the "front" position by one

 

note:

 

above algo are the standard algo that can be referd from ne standard text book of data structure and from relevant sources of internet




Quick Reply


Reply

Some HTML allowed.
Keep your comments above the belt or risk having them deleted.
Signup for a avatar to have your pictures show up by your comment
If Members see a thread that violates the Posting Rules, bring it to the attention of the Moderator Team
Free Sign Up!

Preparing for IIT-JEE ?

Arihant Revision Package for IIT JEE - Books, Practice Tests + Rank Predictor


@ INR 1,995/-

For Quick Info

Name

Mobile No.

Find Posts by Topics

Physics.

Topics

Mathematics.

Chemistry.

Biology

Parents

Board

Fun Zone

Sponsored Ads