Thursday, July 23, 2015

Random Notes

Finding median for given points in a 2-d space (x1, y1, x2, y2......xn,yn)

Find Median of x =  x element in sorted x series at position n/2. = xm
Find Median of y =  y element in sorted y series at position n/2. = yl

Cumulative median =  (xm, yl)
//----------------------------------------------------------------------------------------//

Euclidian Formula to find distance between two points.
\mathrm{d}(\mathbf{p},\mathbf{q})=\sqrt{(q_1-p_1)^2 + (q_2-p_2)^2}.
//----------------------------------------------------------------------------------------//
Given 3 points (x1,y1), (x2,y2), (x3,y3). Find If they form Right-angular-traingle.
Find d1,d2,d3 and apply Pythagorus theorem. 
a^2 + b^2 = c^2 .\,
//----------------------------------------------------------------------------------------//
1+2+3+4....+n = O(n*n);
(1+1/2+1/4+1/8 + ...4/n +2/n)+1/nn = 2n=O(n)




No comments:

Post a Comment