Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def findMin(list: List[Int]) = {
- def findMin_h(list: List[Int], min: Int): Int = {
- list match{
- Nil => throw new Exception("chuju")
- h::Nil => min
- h::t => if(h < min)
- findMin(t, h)
- else
- findMin(t, min)
- }
- }
- findMin_h(list.tail, list.head)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement