09 April 2005

Sort the Google query keywords by frequency using a worst-case O(n) algorithm By Eric Lippert

Let me start today by giving you all a quick refresher on what we mean by the "order" of an algorithm.  Suppose you have a problem where the input can vary in size in some way.  For example, consider the problem "find the average of an array of numbers".  That's a pretty easy problem to solve:

Total = 0
For curNum = LBound(List) To UBound(List)
  Total = Total + List(curNum)
Next
Average = Total / (UBound(List) - LBound(List) + 1)

Read more on Eric's blog at http://blogs.msdn.com/ericlippert/archive/2004/5/12.aspx

 

Comments

# blog.visual-basic-data-mining.net said:
09 April 05 at 11:43 AM
Anonymous comments are disabled