Q33.webp
V

Q33.webp

Question: 33
(Choose 1 answer)
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));
else
return(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));
else
return(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));
else
return(search(p.left,x));
}

Thông tin

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

Share this media

Back
Bên trên Bottom