Let f be an operation whose argument and result is a queue and which is…

Let f be an operation whose argument and result is a queue and which is defined by the axioms:

f (CREATEQ) : : = CREATEQ

f (ADD(i, q)) : : = if ISEMTQ(q) then ADD (i, q)

else ADDQ (FRONT (q), (DELETEQ(ADDQ(i, q))))

If initially the queue is then what does the operation f(ADD (7, q)) will do?

  1. A.

    Inserts ‘7’ in the middle of the queue

  2. B.

    Insert ‘7’ at the front of the queue

  3. C.

    Inserts ‘7’ and then reverse the queue

  4. D.

    None of the above

Attempted by 258 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…