Tuesday, January 22, 2008

Selection sort in python

I'm learning python, so I decided to write selection sort in it. I converted the CPP code from 24btes.com. Here's the code (the array at the beginning contains the numbers that will be sorted):


a = [90, 96, 74, 10, 44, 53, 61, 77, 37, 52, 25, 60, 9, 14, 20, 93, 5, 59, 29, 86, 6, 64, 4, 38, 51, 24, 11, 16, 85, 69, 34, 62, 50, 87, 55, 92, 98, 47, 46, 91, 57, 36, 23, 97, 3, 48, 83, 99, 12, 31, 2, 76, 28, 27, 39, 68, 49, 58, 95, 21, 17, 79, 71, 45, 65, 70, 33, 56, 43, 35, 81, 75, 72, 26, 19, 13, 30, 22, 1, 15, 63, 18, 8, 73, 66, 67, 54, 100, 40, 89, 78, 7, 42, 32, 84, 88, 94, 80, 82, 41]

def selSort (array):
i = 0
listLen = len(array)
while i < (listLen - 1):
minat = i
minval= array[i]

j = i + 1
while j < listLen:
if minval> array[j]:
minat = j
minval= array[j]
j = j + 1

temp = array[i]
array[i] = array[minat]
array[minat] = temp
i = i + 1

print array
print listLen


selSort (a)

Tuesday, January 15, 2008

"Interesting" Quicktime + iTunes license agreement

I was just updating Itunes and Quicktime on my computer, and I got the following license agreement:


What's up with that, eh? I think that it is in english, but with that font how can you be sure? I would be interesting to know exactly how the bug worked that caused this.

Macworld brings down large websites

At the time of writing, engadget and twitter, among others, are down. The outages are the result of people trying to view updates of whats going on at the 2008 macworld keynote. No other event brings down sites on such a large scale.

Thursday, January 10, 2008