55# Pro tip: think long and hard about testing your code.
66# In this assignment, we aren't giving you example function calls.
77
8+
89def my_sort (lst ):
910 ''' Return a sorted copy of a list. Do not modify the original list. Do
1011 not use Python's built in sorted method or [].sort(). You may use
1112 any sorting algorithm of your choice.
1213 '''
1314 pass
1415
16+
1517def sort_dict (d ):
1618 ''' Sort a dictionary by value. The function should return
1719 (not print) a list of key, value tuples, in the form (key, value).
1820 '''
1921 pass
2022
23+
2124def prefixes (seq ):
2225 ''' Create a generator that yields all the prefixes of a
2326 given sequence. Extra credit will be rewarded for doing this
2427 in a single line.
2528 '''
2629 pass
2730
31+
2832def suffixes (seq ):
2933 ''' Create a generator that yields all the suffixes of a
3034 given sequence. Extra credit will be rewarded for doing this
3135 in a single line.
3236 '''
3337 pass
3438
39+
3540def slices (seq ):
3641 ''' Create a generator that yields all the slices of a
3742 given sequence. Extra credit will be rewarded for doing this
3843 in a single line.
3944 '''
4045 pass
4146
47+
4248# HALF WAY POINT! Wahoo!
4349
50+
4451def extract_and_apply (l , p , f ):
4552 '''
4653 Implement the function below in a single line:
@@ -56,6 +63,7 @@ def extract_and_apply(l, p, f):
5663 '''
5764 pass
5865
66+
5967def my_reduce (function , l , initializer = None ):
6068 '''Apply function of two arguments cumulatively to the items of list l, from left to right,
6169 so as to reduce l to a single value. This is equivalent to the 'fold' function from CIS 120.
@@ -67,6 +75,7 @@ def my_reduce(function, l, initializer=None):
6775 '''
6876 pass
6977
78+
7079class BSTree (object ):
7180 ''' Implement a binary search tree.
7281 See here: http://en.wikipedia.org/wiki/Binary_search_tree
0 commit comments