Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
0% Quality Score
Upvotes Received
0
Posts with Upvotes
0
Upvoting Members
0
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
1
0 Endorsements
Ranked #4K
~797 People Reached
Favorite Forums
Favorite Tags
Member Avatar for cmpt

search(l, key): if len(l) == 0: return False elif l[0] == key: return True else: return search(l[1:], key) I was just wondering if there is any way that i can get rid of "elif" statement. The function is suppose to return False if the key is not in the list …

Member Avatar for ptirthgirikar
-1
155
Member Avatar for docaholic

[ICODE]def selsort(l): if len(l)<=1: return l else: for i in range(len(l)): selsort(l[1:]) [/ICODE] Hey guys, this is what I have so far. I have trouble understanding recursion. Anyone know how to use it to do selection sort?

Member Avatar for Dhaneshnm
0
193
Member Avatar for docaholic

how would you sort a class object? say..you have a card class, and in the card class, you can have the suits and face value of a card. how would you sort the cards by face values? (smallest to biggest?) thanks

Member Avatar for docaholic
0
157
Member Avatar for docaholic

does anybody know how to make bubble sort work in progressively smaller sizes and determine if a list is sorted on it's first try? i've got the basic bubble sort algorithm down. i just can't figure out the rest of it (my basic bubble sort code below) [code] def bubbleSort(list1): …

Member Avatar for docaholic
0
140
Member Avatar for docaholic

i'm having problems with a binary search in a list... [code] def binarySearch(list1,faces): first = 0 last = len(list1) - 1 while first <= last: mid = (first + last) / 2 if faces == list1[mid]: return mid elif faces < list1[mid]: last = mid - 1 else: first = …

Member Avatar for woooee
0
69
Member Avatar for docaholic

Hi, I have a question about lists and tables... So far, i've managed to take a list and make a table like so: 23 764 12 54 83 2 543 890 1235 453 98 the list being [23, 764, 12, 54, 83, 2, 543, 890, 1235, 453, 98]. i need …

Member Avatar for woooee
0
83