If the ADT queue had a method clearthat removed all entries from a queue, what would its definition be in the previous link-based implementation?

What will be an ideal response?


A method clearcould repeatedly call dequeue until the queue is empty. One such definition follows:
```
template
void LinkedQueue::clear()
{
while (!isEmpty())
dequeue();
} // end clear

```
However, since dequeue is a boolean-valued method, you could replace the previous while loop with the following one:
```
while (dequeue())
{}

```

Computer Science & Information Technology

You might also like to view...

Multiple-alternative selection structures or ____ selection structures can choose from several alternatives.

A. complex B. staged C. extended D. control

Computer Science & Information Technology

All of the following are examples of being computer literate, EXCEPT ________

A) knowing only how to use your computer for e-mails B) knowing how to avoid hackers and viruses C) knowing how to use the web efficiently D) knowing how to maintain and troubleshoot your computer

Computer Science & Information Technology

?Case 4-2 Arnold takes his networking trainer Ron's help to learn about the array of new communications technologies that are being used today. Ron provides various instances and examples that can help Arnold identify different communication protocols and standards. Ron tells Arnoldthat both the HomePNA Alliance and the HomeGrid Forum are promoting a technology as a unified worldwide standard. Which of the following standards is Ron talking about here?

A. ?G.hn B. ?Universal Mobile Telecommunications System C. ?Licensed-Assisted Access D. ?Long Term Evolution

Computer Science & Information Technology

The primary disadvantage of the WAIT and SIGNAL operation set is that it does not address busy waiting.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology