Skip to content

Commit a8ee57b

Browse files
author
Arun Kirubarajan
authored
Update assignment1.py
1 parent feccb34 commit a8ee57b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

assignment1.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,49 @@
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+
89
def 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+
1517
def 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+
2124
def 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+
2832
def 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+
3540
def 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+
4451
def 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+
5967
def 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+
7079
class BSTree(object):
7180
''' Implement a binary search tree.
7281
See here: http://en.wikipedia.org/wiki/Binary_search_tree

0 commit comments

Comments
 (0)