CSD201_-_PESP_2024_s_1_1500.webp
Izumi99

CSD201_-_PESP_2024_s_1_1500.webp

  • Media owner Izumi99
  • Ngày thêm
Output in the file f1.txt must be the following:
(F,-6,7) (E,2,5) (C,4,3) (Υ,6,-7) (Α,7,9) (D,8,6)
void f2() - Perform pre-order traversal from the root but display to file f2.txt nodes with color<7 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) (1,1,7) (K,-1,5) (J,3,9) (L,5,10) (M,4,6) (G,7,3) (Ε,9,4) (H,10,8)
(C,8,2) (D,6,1) (F,2,-1) (K,-1,5) (Μ,4,6) (G,7,3) (E,9,4)
void f3() - Suppose p is the 5th node in post-order traversal from the root. Delete the node p by copying. Output in the file f3.txt must be the following:
Κ,-1,5) (1,1,7) (M,4,6) (L,5,10) (J,3,9) (F,2,-1) (G,7,3) (D,6,1) (H,10,8) (E,9,4) (C,8,2)(
(Κ,-1,5) (1,1,7) (M,4,6) (L,5,10) (F,2,-1) (G,7,3) (D,6,1) (H,10,8) (E,9,4) (C,8,2)
void f4() - Suppose p is the 3rd node having 2 children in pre-order traversal from the
root. Calculate the number of nodes in the sub-tree with root p. If this number is k then
change p.info.color to 100+k. Output in the file f4.txt must be the following:
(C,8,2) (D,6,1) (F,2,-1) (1,1,7) (K,-1,5) (J,3,9) (L,5,10) (Μ,4,6) (G,7,3) (Ε,9,4) (H,10,8)
2
(C,8,2) (D,6,1) (F,2,106) (1,1,7) (K,-1,5) (J,3,9) (L,5,10) (M,4,6) (G,7,3) (E,9,4) (H,10,8)
+ 100%
Zoom

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

Thông tin

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

Image metadata

Filename
CSD201_-_PESP_2024_s_1_1500.webp
File size
248 KB
Dimensions
1920px x 863px

Share this media

Back
Bên trên Bottom