Rank and Share
Revision as of 17:18, 10 February 2009 by Michael Murtaugh (talk | contribs) (→Approach to this problem)
Rank & Share
http://marketshare.hitslink.com/browser-market-share.aspx?qprid=0
This page will be discussed (& extended) in class.
Approach to this problem
Imagine you are bicycling from Rotterdam to Delft. Along the bike path are kilometer markers. Let's say the marker says 35 at the start of your trip, and 50 when you reach Delft. How far are you on your trip, in terms of percentage (0 to 100), when you reach the sign marked 44?
Well, first you would figure out how far you are from the beginning, or 44-35 = 9 km. And then you would just divide this by the total number of kilometers (or 50 - 25 = 15 km).
9/15 = 0.5999 (or about 60%)
Put in terms of variables, you could write the above as:
pos = (current_km - start_km) / (end_km - start_km)
Where pos is a number from 0 (beginning of trip) to 1.0 (reached the end).