COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Why do we use the isFull() function in a queue?
|
A. to identify if the list has any available position, so we can add if there is or send an overflow error message otherwise
|
|
B. to detect the size of the list then resize it when necessary to adjust the size of the queue
|
|
both A and B
|
|
no answer
|
Explanation:
Detailed explanation-1: -isFull() Operation. This function checks if the rear pointer is reached at MAXSIZE to determine that the queue is full. The following steps are performed in the isFull() operation-Step 1: Check if rear == MAXSIZE-1. Step 2: If they are equal, return “Queue is Full.”
Detailed explanation-2: -isFull() isFull function is used to check whether or not a stack is empty.
Detailed explanation-3: -When data is PUSHed onto stack. peek() − get the top data element of the stack, without removing it. isFull() − check if stack is full. isEmpty() − check if stack is empty.
Detailed explanation-4: -Queue is said to be empty when the value of front is at-1 or the value of front becomes greater than rear (front > rear).
There is 1 question to complete.