Homework 9
1 Scala Functions
For this homework, you will use Scala to implement three sorting functions.
1. Write a function merge_sort(lst: List[Int]): List[Int] that takes
a list, and return a sorted list in increasing order.
2. Write a function selection_sort(lst: List[Int]): List[Int] that
takes a list and return a sorted list in increasing order.
3. Write a function insertion_sort(lst: List[Int]): List[Int] that
takes a list and return a sorted list in increasing order.
You should place your methods inside an object and test them as follows.
Object Main{
// your sorting methods are placed here
def main(args: Array[String]) {
val lst = List(5,4,11,2,3,1,0,9)
println(merge_sort(lst))
println(selection_sort(lst))
println(insertion_sort(lst))
}
}
2 Submission
Please write your solution in a text le by the name of hwk9.scala and submit
it to the dropbox.
1
[SOLVED] CS 431 Programming Language Concepts Homework 9
30.00 $
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
Securely Powered by:
- Homework9-rtqfeb.zip



