DESCRIPTION Students: Please keep in mind the OMSI rules. Save your files often, make sure OMSI fills your entire screen at all times, etc. Remember that clicking CopyQtoA will copy the entire question box to the answer box. In questions involving code which will PARTIALLY be given to you in the question specs, you may need add new lines. There may not be information given as to where the lines should be inserted. MAKE SURE TO RUN THE CODE IN PROBLEMS THAT INVOLVE CODE! QUESTION Fill in the blank: In the binary tree example in Section 1.21, the stored items were numbers. But the same code would work for character strings, without change. To do this in C++, we would need to use ________________. QUESTION When we execute % python x.py what program is executing on the hardware? And what code file will be created from x.py the first time the latter is run? QUESTION -ext .py -run 'python omsi_answer3.py' Add the needed code to the function below, that returns a dictionary showing which distinct numbers are in x, and the counts for each such number. def hist(x): counts = {} for i in x: try: except: print hist([5,2,1,12,2,12]) # {1: 1, 2: 2, 12: 2, 5: 1} QUESTION -ext .py -run 'python omsi_answer4.py' Consider the code on p.26, a class textfile and an example of its use. Below, ntfiles has been changed to a dictionary which will show file names and their memory addresses, for objects of that class. (I've removed a couple of instance functions to simplify things.) class textfile: ntfiles = {} def __init__(self,fname): self.name = fname self.fh = open(fname) a = textfile('x') b = textfile('y') print 'textfile names are', print "the number of text files open is",