ECO121_-_SP_2023_-_FE_87.webp
H

ECO121_-_SP_2023_-_FE_87.webp

SP005, Schweppes, Carton of 24 cans, 320ml, 220.000 2C017, Coca-Cola, Carton of 24 bottles, 600ml, 218.000
MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
Notes:
- Do not edit given statements in the main function
- You can create new functions if you see it is necessary.
- Carefully read the instructions in each question to best complete your the practical exam.
Question 2: (5 marks)
The given file Q2.py already contains statements to implement a simple program to monitor Watch objects using Binary Search Tree structure. You should write statements to the following functions:
f. f1(): Compute the height of given Binary Search Tree (BST).
Expected result:
3
g. f2(): Perform the Post-Order traverse on the BST, but ONLY visit nodes that has Watch's price lager than 3 and less than 8.
Expected result:
CT-BM7466-81H, Citizen, 40, 7.590 SK-SUR211P1, Seiko, 42, 3.690 SK-SUR263P1, Seiko, 41, 3.555 OR-FUNG800300, Orient, 40, 3.762
h. f3(): Insert into the current tree a new Watch which code = 'OR-FGW01006W0', make = 'Orient',size = 38, price = k, where k is height of the current tree before insertion.
+ 100%
Zoom

Close

Thông tin

Category
ECO121
Thêm bởi
happy_smile1
Ngày thêm
Lượt xem
2,047
Lượt bình luận
13
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom