1. Engineering
  2. Computer Science
  3. must be written in scala...

Question: must be written in scala...

Question details

Must be written in ScalaNow, write a tail recursive version of the logTwo function, called logTwoTail. You should implement the helper function as a tail recursive function. import scala.annotation.tailrec @tailrec def logTwoHelper(n: Int, acc: Int): Int - / YOUR CODE HERE def logTwoTail(n: Int): Int YOUR CODE HERE BEGIN TEST assert (logTwoTail(1) e, logTwo (1) must be e assert (logTwoTail(2)1, assert (logTwoTail(3)1, assert (logTwoTail(15)3, logTwo (15) must be 3) assert (logTwoTail(129) 7, logTwo (129) passed(5) //END TEST logTwo (2) must be 1) logTwo (3) must be 1

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution