CSD201_-_PE_-_FA_2023_-_HB_950.webp
M

CSD201_-_PE_-_FA_2023_-_HB_950.webp

(A,7,9) (C,4,3) (D,8,6) (Ε,2,5) (Y,6,-7) (F,-6,7)
(F,-6,7) (Ε,2,5) (C,4,3) (1,6,-7) (Α,7,9) (D,8,6)
void f2() Perform breadth-first traversal from the root but only display to file f2.txt the nodes with ability<6. Hint: Copy the function breadth(...) to function breadth2(...) and modify it. Output in the file f2.txt must be the following:
(C,8,2) (D,6,1) (Ε,9,4) (F,2,3) (G,7,8) (Η,1,7) (1,3,9) (1,5,5) (Κ,4,6)
(C,8,2) (D,6,1) (Ε,9,4) (F,2,3) (1,5,5)
void f3() - Suppose p is the 7-th node when performing the post-order traversal of the tree and f is the father of p. Delete the node f by copying (Note: replace node f by the rightmost node in the left subtree of f if f has two children). Output in the file f3.txt must be the following:
(Η,1,7) (Κ,4,6) (1,5,5) (1,3,9) (F,2,3) (G,7,8) (D,6,1) (Ε,9,4) (C,8,2)
(Η,1,7) (Κ,4,6) (1,5,5) (1,3,9) (F,2,3) (D,6,1) (Ε,9,4) (6,7,8)
void f40)- Suppose p is the 7-th node when performing the post-order traversal of the tree. Calculate the height of sub-tree with root p and suppose this height is k, then set p.info.ability = k. Output in the file f4.txt must be the following:
(Η,1,7) (Κ,4,6) (1,5,5) (1,3,9) (F,2,3) (6,7,8) (D,6,1) (Ε,9,4) (C,8,2)
(H.1.7) (K.4.6) (1.5.5) (1.3.9) (F.2.3) (G.7.8) (D.6.5) (Ε.9.4) (C.8.2)
+ 120%
Zoom

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

Thông tin

Category
CSD201
Thêm bởi
Mỹ Duyên1
Ngày thêm
Lượt xem
1,315
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_PE_-_FA_2023_-_HB_950.webp
File size
67.5 KB
Dimensions
1552px x 660px

Share this media

Back
Bên trên Bottom