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

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -