mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-09 12:11:28 +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) {
|
||||
return head == null ? 0 : 1 + countRecursion(head.next);
|
||||
}
|
||||
|
||||
/**
|
||||
*Returns the count of the list.
|
||||
*/
|
||||
@Override
|
||||
public int count() {
|
||||
return countRecursion(getHead());
|
||||
|
Reference in New Issue
Block a user