Algorithms make my head spin

The Peak Performance course has an exercise (Value Elicitation, Vol 3) where you list your most important, can't-live-without values (at least 10). A list is thoughtfully provided if you draw a blank.

Once you write them down, you then need to order them by importance. Dr. Tharp provides a specific way to do so, in terms of visualization, and gives an example of how to go through the list and determine the order.

Me, being lazy (ha!), decided to write a Python program to store and sort that order. Of course, I make the problem at least twice as difficult by not understanding how to sort the list.

I thought I needed to compare each item against every other item. Not true. I only need to run through the list once for each item, comparing one item against the next on the list, and taking the most important of the match. At the end of that 'run', whatever has 'survived' is the next-most important item. I take it out of the running, and proceed with the ever-diminishing original list.

Maybe I should just post the program so you see what I mean...


Written by Andrew Ittner in misc on Tue 13 May 2003. Tags: follow-up, programming, python, trading