![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
scala
holomain
足够明亮,做够善良
展开
-
scala :冒泡排序
package algorithmimport scala.collection.mutable.ListBufferobject BubbleSort { def main(args: Array[String]): Unit = { val a = ListBuffer(1, 2, 3, 10, 100, 19999, -1998, 9, 234, 234, 9, 4...原创 2018-06-21 16:36:39 · 396 阅读 · 0 评论 -
递归算法的使用:
package algorithmimport java.io.Fileobject RecursiveApp { def main(args: Array[String]): Unit = { """ |递归的使用:适合于树形结构的遍历 |比较递归方式和循环方式的区别 """.stripMargin var s0 = System...原创 2018-06-21 17:20:06 · 206 阅读 · 0 评论 -
scala 二分法查找
package algorithmobject BinarySearch { def main(args: Array[String]): Unit = { val arr = Array(1, 2, 3, 10, 100, 19999, -1998, 9, 234, 234, 9, 43) val index = Binarysearch(arr, 100) ...原创 2018-06-19 19:30:56 · 1135 阅读 · 0 评论 -
scala 选择排序
package algorithmimport org.apache.hadoop.io.LongWritable.Comparatorimport scala.collection.mutable.ListBuffer/** * Created by Administrator on 2018/6/19. */object secSortApp { def main(...原创 2018-06-19 20:50:47 · 567 阅读 · 0 评论 -
sclaa -快速排序
package algorithmobject QuickSortApp { def QuickSort(list: List[Int]): List[Int] = { list match { case Nil => Nil case List() => List() case head :: tail => ...原创 2018-06-19 20:59:45 · 210 阅读 · 0 评论 -
scala 两个Map 集合合并
//参考《快学scala》 集合操作 foldLeft page:180 package alogrithnmimport scala.collection.mutable.Mapobject CombineTwoMap { def main(args: Array[String]): Unit = { val map1 = Map[String, Int...原创 2018-07-06 09:30:41 · 3428 阅读 · 0 评论