CSD201_-_PEQN_-_SU_2024_-_L1_2151.webp
Quốc Hùng2

CSD201_-_PEQN_-_SU_2024_-_L1_2151.webp

unique. The following methods should be completed:
void insert(String xType, int xRate, int xWing) - check if xType.charAt(0) == 'B' then do nothing,otherwise insert new Bird object with type=xType, rate=xRate, wing=xWing to the tree (rate and wing can get arbitrary, even negative values).
void f1() Do not edit this method. Your task is to complete the insert(...) method above only.Output in the file f1.txt must be the following:(B,9,4) (C,4,3) (D,8,6) (Y,6,-7) (E,2,5) (F,-6,7)
(Y,6,-7) (C,4,3) (B,9,4) (E,2,5) (D,8,6) (F,-6,7)
void f2()-Perform breadth-first traversal from the root but display to file f2.txt nodes with rate>4 only. 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) (E,9,4) (F,2,3) (G,7,8) (H,1,7) (1,3,9) (J,5,5) (Κ,4,6)
(C,8,2) (D,6,1) (E,9,4) (G,7,8) (J,5,5)
void f3() - Suppose p is the 4-th node when performing the post-order traversal of the tree and f is the father of p. Delete the node f by copying. Output in the file f3.txt must be the following:(D,6,1) (F,2,3) (Κ,4,6) (J,5,5) (H,1,7) (1,3,9) (G,7,8) (E,9,4) (C,8,2)
(D,6,1) (F,2,3) (K,4,6) (J,5,5) (1,3,9) (G,7,8) (E,9,4) (C,8,2)
Zoom
Close
100%
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
Quốc Hùng2
Ngày thêm
Lượt xem
2,411
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_PEQN_-_SU_2024_-_L1_2151.webp
File size
199.7 KB
Dimensions
1025px x 792px

Share this media

Back
Bên trên Bottom