In: Economics
A data structure is a method of organizing information. These structures include files, lists, arrays, trees, records and tables. Queues are related to ordered lists. With the queue, the new pieces of data are placed at the rear of the data structure, and the deletions are placed at the front. The first piece of data entered into the data structure is the first piece removed from the structure. With queues, data does not remain in the data structure for as long as with stacks. Queues can be compared to lines at the store, where the first person in line is the first person to receive a service.”
Queues have the advantages of being able to handle multiple data types and they are both flexible and flexibility and fast. Moreover, queues can be of potentially infinite length compared with the use of fixed-length arrays.
A major disadvantage of a classical queue is that a new element can only be inserted when all of the elements are deleted from the queue.
As an example, consider the queue:
As an example, consider the queue:
Now, if the first three members are de-queued from the front (left hand side) of the queue, we get:
Where the queue remains full but we can not insert a new element because the back of the queue (right hand side) remains as it was before. This is the major limitation of a classical queue, i.e. even if there is space available at the front of the queue we can not use it.
So to overcome the problem above, we can use a circular queue. With reference to Circular Queue - Data Structures, this can be defined as a “linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the last position is connected back to the first position to make a circle.” We can represent this circular queue as:
If a queue is considered circular, when a de-queue operation occurs, re-pointing the head of the queue to the next element is a simple assignment. This also avoids extensive re-buffering when all the elements would otherwise move one to the left, so to speak, after a de-queue occurs.
Queuing theory, the mathematical study of waiting in lines, is a branch of operations research because the results often are used when making business decisions about the resources needed to provide service. At its most basic level, queuing theory involves arrivals at a facility (i.e., computer store, pharmacy, bank) and service requirements of that facility (i.e., technicians, pharmacists, tellers). The number of arrivals generally fluctuates over the course of the hours that the facility is available for business (Figure 2).
Figure 2: Number of Arrivals at Facility
Customers demand varying degrees of service, some of which can exceed normal capacity (Figure 3). The store manager or business owner can exercise some control over arrivals. For example, the simplest arrival-control mechanism is the posting of business hours. Other common techniques include lowering prices on typically slow days to balance customer traffic throughout the week and establishing appointments with specific times for customers. The point is that queues are within the control of the system management and design.
Figure 3: Service Requirements
Queuing management consists of three major components: