CSD203_-_T1_2171.webp
blue_sky

CSD203_-_T1_2171.webp

  • Media owner blue_sky
  • Ngày thêm
Bài viết gốc: Chủ đề 'CSD203 - T1'
Assuming the list contains at least 3 nodes, find the node satisfying that: the difference of LValue and RValue is the minimum (it also means that: |LValue - RValue | is the minimum).
Input: size = 4
Expected result:
MD033, Mirinda, 45, 320ml, 12.000
Question Q2:
The given file Q2.py already contains statements to implement a simple program using Binary Search Tree structure. You should write statements to the following functions:
f. f1(): How many leaf nodes with key>10 are there in the Binary Search Tree (BST).
Input: size = 10
Expected result:
4
g. f2(): Compute the BST's height, then insert a new node with key=height*height to the tree.
Input: size = 5
Expected result:
4
10
15
20
30
40
h. f3(): Find the minimum value in the tree.
Input: size = 15
Expected result:
3
i. f4(): Delete the node with maximum key in the tree.
Input: size = 5
Expected result:
10
15
20
30
40 (this node is deleted)
j. f5(): Compute the average value of all leaf nodes in the BST. (get one digit after the decimal point)
Input: size = 4
Expected result:
27.5
(when the tree contains four nodes, the leaf nodes are 15 and 40; so the average value of all leaf
nodes is 27.5)
+ 100%
Zoom

Close
Chưa có bình luận nào.

Thông tin

Category
CSD203
Thêm bởi
blue_sky
Ngày thêm
Lượt xem
1,061
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD203_-_T1_2171.webp
File size
215.8 KB
Dimensions
1920px x 1009px

Share this media

Back
Bên trên Bottom