Queue: Consider the following mechanism to handle the wraparound for front. Do they all work? If so, what do you think of them as implementations?

```
a. front = ( front == capacity ) ? 0 : front++;
b. front = front++ % capacity;
```


a. This will work, and is more elegant than the first method originally presented in the chapter.
b. This method will not work because the increment expression will be evaluated, and then front will be incremented.

Computer Science & Information Technology

You might also like to view...

You cannot explode all the pie slices in a pie chart

Indicate whether the statement is true or false

Computer Science & Information Technology

Fire suppression systems are common in small office buildings

Indicate whether the statement is true or false.

Computer Science & Information Technology

FIGURE EX 2-1 Which button would you select in the dialog box shown in Figure EX 2-1 above to fill in the series with formatting intact?

A. Growth B. Linear C. AutoFill D. Trend

Computer Science & Information Technology

What is an internal sort?

What will be an ideal response?

Computer Science & Information Technology