CSD201_-_PE_-_SU_2024_2168.webp
C

CSD201_-_PE_-_SU_2024_2168.webp

  • Media owner Carla89
  • Ngày thêm
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) (Ε,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 pre-order traversal from the root but display to file f2.txt non-leaf nodes only.
Hint: Copy the function preOrder(...) to function preOrder2(...) and modify it. Output in the file f2.txt must be the following:
(C,8,2) (D,6,1) (F,2,-1) (E,9,4) (G,7,3) (H,10,8) (1,1,7) (K,-1,5) (M,4,6) (J,3,9) (L,5,10)
(C,8,2) (D,6,1) (E,9,4) (H,10,8) (1,1,7) (K,-1,5) (1,3,9)
void f3() - Suppose the tree contains at least 4 elements. Delete by copying the node p having 4th smallest type. (In given data p is (G,7,3) because the 4th smallest type is 3). Output in the file f3.txt must be the following:
(C,8,2) (D,6,1) (E,9,4) (F,2,-1) (G,7,3) (H,10,8) (1,1,7) (J,3,9) (K,-1,5) (L,5,10) (M,4,6)(C,8,2) (D,6,1) (E,9,4) (F,2,-1) (H,10,8) (1,1,7) (J,3,9) (Κ,-1,5) (L,5,10) (Μ,4,6)

void f4() - Suppose p is the 3rd node having right-child in pre-order traversal from the
root. Rotate p to left. Output in the file f4.txt must be the following:
(C,8,2) (D,6,1) (E,9,4) (F,2,-1) (G,7,3) (H,10,8) (1,1,7) (J,3,9) (K,-1,5) (L,5,10) (M,4,6)
2
(C,8,2) (D,6,1) (E,9,4) (F,2,-1) (G,7,3) (J,3,9) (H,10,8) (L,5,10) (1,1,7) (Κ,-1,5) (Μ,4,6)
Zoom
+ 100%
Close
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
CSD201_-_PE_-_SU_2024_2168.webp
File size
259.9 KB
Dimensions
1920px x 1001px

Share this media

Back
Bên trên Bottom