Guest User

Untitled

a guest
Feb 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. sub search
  2. {
  3. my ($course_number, $courses_ref, $total) = @_;
  4.  
  5. print $total . " + " . $course_number . " = " . ($total + $course_number) . "\n";
  6.  
  7. my @courses = @{$courses_ref};
  8.  
  9. if($course_number == 0) {
  10. return $total;
  11. } else {
  12. print max(search($courses[$course_number]->{follow_up_one}, $courses_ref, $total + $course_number),
  13. search($courses[$course_number]->{follow_up_two}, $courses_ref, $total + $course_number));
  14. }
  15. }
Add Comment
Please, Sign In to add comment