I'm trying to find the smallest and highest single value of a python array, but something is still flawed.
def pegaExtremosUnicos(v):
i = 1
for i in range(len(v)):
atual = v[i]
j = i - 1;
while (j >=0) and (atual < v[j]):
v[j +1] = v[j]
j = j -1
v[j + 1] = atual
i = 1
while i < len(v):
if v[i] == v[i-1]:
del v[i]
del v[i-1]
i = i +1
d = [v[0],v[len(v)-1]]
return tuple(d)
What was my mistake in this algorithm?