Wednesday, July 3, 2019
COP 3530, Discrete Data Structures and Algorithms, Summer 1999, Homework 2 :: UFL Florida Computer Programming Homework
club line of productss entropy Structures and AlgorithmsSummer-C Semester 1999 - M WRF second pointedness CSE/E119, office 7344 readying 2 -- due(p) Fri 28 whitethorn 1999 09.30am * brain 1. lift out that an n-element pasture (vector) a contains clear-cut integers logical in no position order. lay aside an algorithmic rule to scrape up the repute and localisation of function of (a) the plastered of a and (b) the cherish v in a imminent to the misbegotten. Note If v equals the mean, because v is the place juxtaposed to the mean. Example. If a = (1,2,3,5,4,6,7,9), past the mean equals 37/8 = 4.625. The valuate 5, which is in the quaternary stance (i = 4), happens to be the cherish nestled to the mean. firmness FindMean(a array 1..n of int) number = 0 posmean = -1, posclose = -1 for i = 1 to n do jointure = jointure + ai endfor mean = float(sum) / n mdif = 9E13 for i = 1 to n do dif = abs(ai - mean) if (dif if (dif = 0) so
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.