Recently Added Questions & Answers

 

==> Circular queue--

  •  Circular queue is a linear data structure. It follows FIFO principle
  •  In circular queue the last node is connected back to the first node to make a circle
  •  In circular queue the last node is connected back to the first node to make a circle
  • Both the front and the rear pointers points to the beginning of the array.
  • It is also called as “Ring buffer”.
 

==> Algorithm for Enqueue operation using array--

        Step 1. start

        Step 2. if (front == (rear+1)%max)

                   Print error “circular queue overflow “

       Step 3. else { rear = (rear+1)%max

                   Q[rear] = element;

                  If (front == -1 ) f = 0;

                 }

       Step 4. stop

 

 

==> Algorithm for Dequeue operation using array--

        Step 1. start

        Step 2. if ((front == rear) && (rear == -1))

                   Print error “circular queue underflow “

       Step 3. else { element = Q[front]

                If (front == rear) front=rear = -1

              Else

             Front = (front + 1) % max

                   }

     Step 4. stop

 

==>  simple queue--

  • A simple queue is the most basic queue. In this queue, the enqueue operation takes place at the rear, while the dequeue operation takes place at the front: Its applications are process scheduling, disk scheduling, memory management, IO buffer, pipes, call center phone systems, and interrupt handling
  • Simple QUEUE of Characters (Array Implementation of Queue with maximum size MAX)
  1. Insert an Element on to QUEUE
  2. . Delete an Element from QUEUE
  3. Demonstrate Overflow and Underflow situations on QUEUE
  4. . Display the status of QUEUE
  5. Exit 

==> Disadvantage Simple Queue--

  • When the first element is serviced, the front is moved to next element. However, the position vacated is not available for further use. Thus, we may encounter a situation, wherein program shows that queue is full, while all the elements have been deleted are available but unusable, though empty. 
 

==> Implementation of Queue--

  • Queue can be implemented using an Array, Stack or Linked List.
  • The easiest way of implementing a queue is by using an Array.
  • Initially the head(FRONT) and the tail(REAR) of the queue points at the first index of the array (starting the index of array from 0).
  • As we add elements to the queue, the rear keeps on moving ahead, always pointing to the position where the next element will be inserted, while the front remains at the first index.
  • When we remove element from Queue, we can follow two possible approaches (mentioned [A] and [B] in above diagram).
  • In [A] approach, we remove the element at front position, and then one by one move all the other elements on position forward.
  • In approach [B] we remove the element from front position and then move front to the next position.
  • In approach [A] there is an overhead of shifting the elements one position forward every time we remove the first element.
  • In approach [B] there is no such overhead, but whenever we move head one position ahead, after removal of first element, the size on Queue is reduced by one space each time.
 

==> Queue--

  • Queue is a first in first out FIFO linear data structure Queue is an important data structure for computer applications even.
  • Queue is linear data structure in which deletion of element can take place only at one end called the front end and insertion can take place at the other end called the rear.

==> Applications of Queue--

  • Queue, as the name suggests is used whenever we need to have any group of objects in an order in which the first one coming in, also gets out first while the others wait for there turn, like in the following scenarios : 
  1. Serving requests on a single shared resource, like a printer, CPU task scheduling etc.
  2. In real life, Call Center phone systems will use Queues, to hold people calling them in an order, until a service representative is free.
  3. Handling of interrupts in real-time systems. The interrupts are handled in the same order as they arrive, First come first served. 

Jump to Page : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

Recommended Question Bank

General - Computer Science
View
- Computer organisation and architecture
View
NA - Java
View
- javascript
View
- STORAGE AREA NETWORKS
View
Mejona - Mejona Technology
View
VTU - NCES(Non - Conventional Energy Resources
View
- Java Basic Codes
View
VTU - STORAGE AREA NETWORK
View
- HIGHWAY ENGINEERING
View
- COMPUTER ORGANIZATION
View
- Quantity Surveying and Contracts Management
View
- Design of RC Structural Elements
View
- Ground Water and Hydraulic
View
- Urban Transport Planning
View
- Basic Geotechnical Engineering
View
VTU - Municipal Waste Water Engineering
View
VTU - Design of Steel Structures Elements
View
- Interview Question Bank
View
VTU - Artificial Intelligence
View
Visvesvaraya Technological University (VTU) - Ground water hydraulic
View
-
View
VTU - Artificial intelligence and Machine Learning (AIML)
View
VTU - Energy and Environment
View
VTU - User Interface Design
View
- Data Structures and Algorithms
View
VTU - Big Data Analytics
View
VTU - Engineering Chemistry
View
VTU - User Interface Design (UID)
View
Entrance Exam for job - Entrance Exam Questions
View
VTU - Elements of Civil Engineering and Mechanic
View
VTU - Computer Graphics and Visualization
View
VTU - Object Oriented Concepts
View
VTU - System Software and Compiler Design
View
VTU - Web Technology and its Applications
View
VTU - Cloud Computing and Its Applications
View