Page 1 of 1

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
by answerhappygod
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 1
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 1 (300.52 KiB) Viewed 21 times
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