The following hybrid method of representing a queue has, to a certain extent, the advantages of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The following hybrid method of representing a queue has, to a certain extent, the advantages of both the linked and sequential representations. The queue is represented using a linked list of nodes with two pointers, F and R, to the first and last nodes of the list, respectively. The nodes have two fields, ITEM and LINK. LINK is a pointer to the next node in the list and ITEM is an array of M queue entries, where M is some fixed constant. For example, with M=5, suppose that the 12 values a, b, c, f, g, h, k, m, p, q, t, x were inserted into an empty queue in that order and then two values were deleted from the queue. The resulting queue would be represented by the following list: hkmpq F 1 x R The front of the queue is accessed using the pointer F and an index FIRST indicating the position in the array F ITEM of the first element in the queue. The rear of the queue is accessed using the pointer R and an index LAST indicating the position in the array R ITEM of the last element in the queue. In the above example the value of FIRST would be 3 and the value of LAST would be 2. Notes: (i) It is assumed here that array elements are indexed starting from 1. (ii) An empty queue is represented by F= nil. Give algorithms for the QUEUE and UNQUEUE operations. The following hybrid method of representing a queue has, to a certain extent, the advantages of both the linked and sequential representations. The queue is represented using a linked list of nodes with two pointers, F and R, to the first and last nodes of the list, respectively. The nodes have two fields, ITEM and LINK. LINK is a pointer to the next node in the list and ITEM is an array of M queue entries, where M is some fixed constant. For example, with M=5, suppose that the 12 values a, b, c, f, g, h, k, m, p, q, t, x were inserted into an empty queue in that order and then two values were deleted from the queue. The resulting queue would be represented by the following list: hkmpq F 1 x R The front of the queue is accessed using the pointer F and an index FIRST indicating the position in the array F ITEM of the first element in the queue. The rear of the queue is accessed using the pointer R and an index LAST indicating the position in the array R ITEM of the last element in the queue. In the above example the value of FIRST would be 3 and the value of LAST would be 2. Notes: (i) It is assumed here that array elements are indexed starting from 1. (ii) An empty queue is represented by F= nil. Give algorithms for the QUEUE and UNQUEUE operations.
Expert Answer:
Related Book For
Entrepreneurial Finance
ISBN: 978-1305968356
6th edition
Authors: J. Chris Leach, Ronald W. Melicher
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
(2) Use Figure 10.2 shows a multi-degree-of-freedom (MDOF) model of three connected masses. Find the following for the MDOF system in Figure 10.2: Find expressions for the kinetic energy (T) and...
-
Calculate the price of a bond that pays $80 coupon semiannually and mature in 13 years if its yield to maturity is 9%. The face value of the bond is $1,000.
-
What aspects of the Arthur Andersen culture contributed to the scandal?
-
A states department of transportation plans to develop a new section of interstate highway and receives 16 bids for the project. The state plans to hire four of the bidding companies. How many...
-
Recall that Cookie Creations sells fine European mixers that it purchases from Kzinski Supply Co. Kzinski warrants the mixers to be free of defects in material and workmanship for a period of one...
-
An eagle is flying horizontally at a speed of 2.9 m/s when the fish in her talons wiggles loose and falls into the lake 4.4 m below. Calculate the magnitude of the velocity of the fish relative to...
-
Byrd Company produces one product, a putter called GO-Putter. Byrd uses a standard cost system and determines that it should take one hour of direct labor to produce one GO-Putter. The normal...
-
A friend of yours wishes to open a small business. She will sell microwave slow cookers. She wishes to operate out of her house in a nice residential area. She is thinking of using a wireless LAN to...
-
Is the equation for the area of a trapezoid, A = 1/2[a(b1 + b2)], where a is the height and b1 and b2 are the bases, dimensionally correct ( Figure 1.13)? -b- -b- FIGURE 1.13 The area of a trapezoid...
-
Choose a country from three of the regions presented in Table 6.7. Using the Internet, collect as much information as you believe is needed to identify the potential for market segments based on age,...
-
Demonstrate that the shift operators \(\tilde{A}_{i j}\) obey the commutation relations (10.8). Data from Eq. 10.8 [j, kl] = 8jk 8kj
-
For Problem 6.8, (a) Fit the corresponding negative binomial model with the same linear predictor. (b) Compare the analysis between part (a) and that from Problem 6.8. 6.8 For the Sexual Health pilot...
-
You find a container of an unknown clear liquid. You are interested in its contents, but you have no chemical analysis devices at hand. You do have a good electronic scale, so you measure out...
-
A signal is bandlimited to 12 kHz. The band between 10 and 12 kHz has been so corrupted by excessive noise that the information in this band is non-recoverable. Determine the minimum sampling rate...
-
Refer to Example 9.15. Add the following functionality to this program: Allow the user to enter the cost of a gallon of gas on each trip and use a function, Cost() to calculate the cost of purchasing...
-
What are convertible notes? Why are convertible notes issued, and who typically issues them?
-
Salza Technology Corporation increased its sales from $375,000 in 2015 to $450,000 in 2016 as shown in the firms income statements resented below. LeAnn Sands, chief executive officer and founder of...
-
Following is the rate-of-return component information for First Venture investors: Rate Return Component Component Liquidity Premium .... 5% Risk-free Rate .. 6 Advisory Premium ....... 9 Market Risk...
-
Hannah Gilpin is the controller of Blakemore Auto Glass, a division of Eastern Glass and Window. Her division has been under pressure to improve its divisional operating income. Currently, divisions...
-
Key success factors. Dalworth Construction Company provides construction services for major projects. Managers at the company believe that construction is a people-management business, and they list...
-
How do companies add value, and what are the dimensions of performance that customers are expecting of companies?
Study smarter with the SolutionInn App