Answer to Question #62294 in Java | JSP | JSF for Paul
Give an implementation of the size() method for the singularly linked list class, assuming that we did not maintain size as an instance variable
1
2016-09-29T14:16:03-0400
public int size() {
Node<AnyType> tmp = head;
int size = 0;
if (head == null) {
return size;
} else {
size++;
while (tmp.next != null) {
tmp = tmp.next;
size++;
}
}
return size;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF
Comments
Leave a comment