mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-09 20:20:56 +08:00
Update CountSinglyLinkedListRecursion.java (#2170)
Only method comment for public recursive method.
This commit is contained in:
@ -18,7 +18,9 @@ public class CountSinglyLinkedListRecursion extends SinglyLinkedList {
|
|||||||
private int countRecursion(Node head) {
|
private int countRecursion(Node head) {
|
||||||
return head == null ? 0 : 1 + countRecursion(head.next);
|
return head == null ? 0 : 1 + countRecursion(head.next);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*Returns the count of the list.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int count() {
|
public int count() {
|
||||||
return countRecursion(getHead());
|
return countRecursion(getHead());
|
||||||
|
Reference in New Issue
Block a user