without krenighanlin but recursive