3. What will be the output of this Rust code searching for value 5 in the linked list 1 -> 3 -> 5 -> 7?
struct Node {
value: i32,
next: Option,
}
fn search(head: &Option, target: i32) -> bool {
let mut current = head.as_ref();
while let Some(node) = current {
if node.value == target {
return true;
}
current = node.next.as_ref();
}
false
}
fn main() {
let list = Some(Box::new(Node { value: 1, next: Some(Box::new(Node { value: 3, next: Some(Box::new(Node { value: 5, next: Some(Box::new(Node { value: 7, next: None })) })) })) }));
println!("{}", search(&list, 5));
}