CSD203_-_PE_-_SU_2024_2156.webp
Todo2000

CSD203_-_PE_-_SU_2024_2156.webp

  • Media owner Todo2000
  • Ngày thêm
void f1(self, name, age, salary) - check if name start with = "Y" or age <0 or salary <=0 then do nothing, otherwise insert new Employee with Name=name, Age = age and Salary =salary to the tree. Output in this case like that:
OUTPUT
(AY, 35, 35) (F, 25, 25) (H, 20, 20) (HQ, 18, 18) (Q1, 10, 10) (P, 21, 21) (Η, 31, 31) (Ε, 28, 28) (C, 32, 32) (Β,45, 45) (D, 40, 40) (T, 39, 39) (C, 50, 50) (E, 52, 52) (Τ, 60, 60)
(AY, 35, 35) (F, 25, 25) (B, 45, 45) (H, 20, 20) (H, 31, 31) (D, 40, 40) (C, 50, 50) (HQ, 18, 18) (P, 21, 21) (Ε,28, 28) (C, 32, 32) (Τ, 39, 39) (Ε, 52, 52) (Q1, 10, 10) (Τ, 60, 60)
void f2(self) - Perform post-order traversal from the root but display only the node having age is an even number and salary > 20. Hint: Copy the function postVisit(...) to postVisit2(...) and modify it. Output in this case like that:
OUTPUT
(Q1, 10, 10) (HQ, 18, 18) (P, 21, 21) (Η, 20, 20) (Ε, 28, 28) (C, 32, 32) (H, 31, 31) (F, 25, 25) (T, 39, 39) (D,40, 40) (Τ, 60, 60) (E, 52, 52) (C, 50, 50) (B, 45, 45) (ΑΥ, 35, 35)
(Ε, 28, 28) (C, 32, 32) (D, 40, 40) (Τ, 60, 60) (E, 52, 52) (C, 50, 50)
Zoom

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

Thông tin

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

Image metadata

Filename
CSD203_-_PE_-_SU_2024_2156.webp
File size
198.1 KB
Dimensions
957px x 792px

Share this media

Back
Bên trên Bottom