What is the correct code for void add(String x) operation? Such an operation adds x to the queue
A queue based on a linked list uses the following code
```
class Node
{
String element;
Node next;
Node (String el, Node n)
{
element = el;
next = n;
}
}
Node front = null, rear = null;
```
A) rear = new Node(x, null);
B)
rear = new Node(x, null);
rear = rear.next;
C)
if (rear != null)
{
rear.next = new Node(x, null);
rear = rear.next;
}
else
{
rear = new Node(x, null);
front = rear;
}
D)
if (rear != null)
{
rear.next = new Node(x, null);
rear = rear.next;
}
else
{
rear.next = new Node(x, null);
front = rear;
}
C)
if (rear != null)
{
rear.next = new Node(x, null);
rear = rear.next;
}
else
{
rear = new Node(x, null);
front = rear;
}
You might also like to view...
Which of the following is NOT a desktop OS supported by Intune with an Intune client installed?
A. Windows 8.1 RT B. Windows 10 Pro C. Windows 7 Ultimate D. Windows Vista Business
A website that is used within a company is called a(n) ________
A) subsite B) ISP C) Internet D) Intranet
To convert an existing form to a split form, the form must be open in ________
A) Form view B) Design view C) Datasheet view D) Layout view
Referring to the figure above, the padding that is indicated to appear around the list items will help to make them look a bit more like ____.
A. icons B. links C. buttons D. inline elements