language agnostic - Finding mean in linked list -
I'm the only way to find the middle element in the only link list by going to the bar.
What is the way to find average of elements in the list? Based on your comments, I think that you are asking about arithmetic mean () if
You know how many elements are, you can get rid of the count.
node current = root; Double zodiac = 0; Int count = 0; While (current! = Null) {sum + = current.el; Count ++; Current = Current } System.out.println (sum / count);
Comments
Post a Comment