What is wrong with the following enqueue algorithm?Algorithm enqueue (queue, dataIn)   allocate (new node)   move dataIn to new node data   set new node next to null pointer   if (empty queue)      set queue front to address of new data   else      set next pointer of rear node to address of new node   end if   set queue rear to address of new node   increment queue count   return trueend enqueue

A. It does not test if the queue is empty.
B. It does not test if the queue is full.
C. It does not display error messages.
D. The next pointer of rear node should be set to null.


Answer: B

Computer Science & Information Technology

You might also like to view...

Freemium software is free to download and install

Indicate whether the statement is true or false

Computer Science & Information Technology

public static int exampleRecursion (int n){     if (n == 0)         return 0;    else         return exampleRecursion(n - 1) + n * n * n;}What does the code in the accompanying figure do?

A. Returns the cube of the number n B. Returns the sum of the cubes of the numbers, 0 to n C. Returns three times the number n D. Returns the next number in a Fibonacci sequence

Computer Science & Information Technology

An amortization table shows all of the following EXCEPT ________

A) interest payments over the life of the loan B) interest rate for each payment C) principal payments over the life of the loan D) remaining balance of the loan

Computer Science & Information Technology

Biz Stone and Evan Williams started Twitter as a way for people in their office to keep in touch with each other by exchanging short messages about what they were doing. They limited the size of each message to 140 characters so that people could send and receive messages using text messaging on their cell phones. Discuss Twitter's main features.

What will be an ideal response?

Computer Science & Information Technology