复杂迭代代码分析

package com.xing.listfile

/**
  * Created by DengNi on 2017/2/25.
  */
object recursive extends  App{

  recursive(1,5)

  def recursive(left:Int,right:Int):Unit ={

      if (left < right){
        val center = (right + left) / 2
        recursive(left ,center)
        recursive(center + 1 ,right)
        println("while " + center)

      }
  }
}
/*while 1
while 2
while 4
while 3*/



你可能感兴趣的:(复杂迭代代码分析)