CSD201_-_SP_2023_-_FE_166.webp
hirosi212

CSD201_-_SP_2023_-_FE_166.webp

42
Multiple choices 42/50
(Choose 1 answer)
Next
Suppose we are considering a binary search tree.Select the most correct java code snippet that search a node with value x on the sub-tree with root p.
A . Node search(Node p, int x){if(p.info==x) return(p);
if(x<p.info)}return(search(p.left,x));elsereturn(search(p.right,x));
B. Node search(Node p, int x){ if(p==null) return(null);if(p.info==x) return(p);if(x<p.info)}return(search(p.left,x));elsereturn(search(p.right,x));
C. Node search(Node p, int x){ if(p==null) return(null);if(p.info==x) return(p);if(x<p.info)return(search(p.right,x));elsereturn(search(p.left,x));
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 17
18 19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 46
47
48
49
50

Thông tin

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

Share this media

Back
Bên trên Bottom