@fitzcn/

LimitedWeakHookersealion

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
def nameSort(unsorted, sorted):
	nextNameToAdd = unsorted[0]
	for name in unsorted:	
		if name < nextNameToAdd:
			nextNameToAdd = name
	print(sorted)
	print("moving " + nextNameToAdd + " to sorted")
	unsorted.remove(nextNameToAdd)		
	sorted.append(nextNameToAdd)
	while len(unsorted) > 0:
		nameSort(unsorted, sorted)


namesUnsorted = ["Xavier Price-Kirkham","Matthew Alviti","Matthew Faden","Meredith Ford","Max Goldber","Jordana Graifman","Hannah Greene","Chelsea Kim","Ji Min Shin","Sam Spector","Tianyi Yang","Marina Min","Amy Parker"]
namesSorted = []
nameSort(namesUnsorted, namesSorted)

print(namesSorted)

"""
PSEUDOCODE
start with two lists:
	unsorted names (full)
	sorted names (empty)
scan unsorted names left to right, keeping track the person with the "lowest" name in alphabetical order
once passed through the whole set of unsorted names, add the candidate to the end of the list of sorted names
repeat scanning until unsorted names is empty
"""