Write a size method for a linked list implementation of a queue that does not have a count member.
What will be an ideal response?
```
public int size()
{
int count; // number of nodes
if (head == null)
count = 0;
else
{
count = 1;
LinearNode
while(temp.getNext() != null)
{
count++;
temp = temp.getNext(); // go to next node
} // end while
} // end else
return count;
} // end method size
```
Computer Science & Information Technology
You might also like to view...
The Delete cropped areas of a picture is an option in the ________ dialog box
Fill in the blank(s) with correct word
Computer Science & Information Technology
Higher ISO settings usually result in greater dynamic range. True or false?
Indicate whether the statement is true or false
Computer Science & Information Technology