Question 1
Given the following binary search tree bst:
9
/ \
/ \
7 13
/ / \
/ / \
3 11 15
/ \
/ \
1 5
Given the following binary search tree bst:
9
/ \
/ \
7 13
/ / \
/ / \
3 11 15
/ \
/ \
1 5
For this assignment, you should turn in four files:
a. A file containing the definition of the LinkedBinaryTree class, including all the additional methods implemented in this assignment (questions 2 and 4).
b. 3 ‘.py’ files: each one includes the functions you wrote for questions 1, 3 and 5.Name your files: ‘YourNetID_hw7_q1.py’, ‘YourNetID_hw7_q3.py’, and ‘YourNetID_hw7_q5.py’.Note: your netID follows an abc123 pattern, not N12345678.
In this assignment, we provided ‘LinkedBinaryTree.py’ file (with the implementation of a binary tree).
You should submit your homework via Gradescope. For Gradescope’s autograding feature to work:autograding feature to work:
a. Name all functions and methods exactly as they are in the assignment specifications.
b. Make sure there are no print statements in your code. If you have tester code, please put it in a “main” function and do not call it.
Define a LinkedQueue class that implements the Queue ADT.
Implementation Requirement: All queue operations should run in θ(1) worst-case.
Implement an interpreter-like postfix calculator. Your program should repeatedly:
-->’Give a recursive implement to the following function:
def list_min(lst, low, high)
The function is given lst, a list of integers, and two indices: low and high (low≤high), which indicate the range of indices that need to be considered.
Submission instructions:
a) Youshouldturnin6files:
3 ‘.py’ files: one, with all the code related, to each of the questions 2-4.Name your files: ‘YourNetID_hw3_q2.py’, ‘YourNetID_hw3_q3.py’, and
‘YourNetID_hw3_q4.py’.
A ‘.pdf’ file with all your written answers. Name your file: ‘YourNetID_hw3.pdf’ Note: your netID follows an abc123 pattern, not N12345678.
YoushouldsubmityourhomeworkviaGradescope.
Use the definitions of O and of Θ in order to show the following:
Draw the memory image for evaluating the following code:
为以下代码绘制内存图像:
>>> lst1 = [1, 2, 3]
>>> lst2 = [lst1 for i in range(3)]
>>> lst2[0][0] = 10
>>> print(lst2)
Due by Thursday 9/21, 11:59pm
Submission instructions:
A ‘.pdf’ file for the first question.
Name your file: ‘YourNetID_hw1_q1.pdf’
5 ‘.py’ files, one for each question 2-6. Name your files:
‘YourNetID_hw1_q2.py’ and ‘YourNetID_hw1_q3.py’, etc.