Q3: Source code = 1 2 3 4 5 6 7 8 9 10 11 12 13 NMO00 ON object 03 { def doit(x:Int, y:Int): Int = { var s = 0; for (i <
Posted: Fri Apr 29, 2022 6:48 am
Q3: Source code = 1 2 3 4 5 6 7 8 9 10 11 12 13 NMO00 ON object 03 { def doit(x:Int, y:Int): Int = { var s = 0; for (i <- i to y) { var a = 1; while( a < x ) { a = a*2; S = 5 + a - y; } } < - S } 14 = 15 16 17 18 19 20 21 non 0 0 0 def main(args: Array[String]): Unit = { println(doit(3, 2)) println(doit(17, 1)) println(doit(2, 5)) } }
Q3.1 (10%) What is the output after running this program? Jūsu atbilde Q3.2 (10%) What is the time complexity of the function doit(x,y)? Jūsu atbilde
Q3.1 (10%) What is the output after running this program? Jūsu atbilde Q3.2 (10%) What is the time complexity of the function doit(x,y)? Jūsu atbilde