In the following code for the add method for a linked queue implementation, what is the missing code?
def add(self, newItem): newNode = Node(newItem, None) if self.isEmpty(): self.front = newNode else: self.rear.next = newNode self.size += 1

A. self.rear = newNode
B. self.rear -= 1
C. self.rear.prev = None
D. self.front = self.next

Answer: A

Computer Science & Information Technology

You might also like to view...

The cleaner and more positive the image you project on LinkedIn and other social networks, the better your chances for obtaining a job

Indicate whether the statement is true or false

Computer Science & Information Technology

You can use the ____ to open a sequential access file for output.

A. CreateText method B. StreamReader object C. StreamWriter object D. AppendText method

Computer Science & Information Technology