- 博客(4)
- 收藏
- 关注
原创 一组N个数确定其中第k个最大者:选择问题
一组N个数确定其中第k个最大者:选择问题一、排序解法二、稍微好一点的解法一、排序解法将这N个数读进一个数组中,再通过某种简单的算法,比如冒泡排序法,以递减顺序将数组排序,然后返回位置k上的元素。public static int sel_k_one(int[] nums,int k){ for (int i=0;i<nums.length - 1;i++){ for(int j=0;j<nums.length - 1 - i;j++){ if
2021-02-21 22:54:53
499
2
原创 我的第一个Flink程序-WordCount
我的第一个Flink程序-WordCountWord CountWord Countpackage com.atttttt//导入一些隐式类型转换,implicitimport org.apache.flink.streaming.api.scala._object WordCount { case class WordWithCount(word : String , count : Int) def main(args : Array[String]) : Unit = {
2020-07-13 11:31:38
289
原创 Java数组的排序(冒泡、选择、快速排序)
Java 数组排序(冒泡、选择、快排)冒泡排序选择排序快速排序冒泡排序冒泡排序进行 length - 1 次循环,例如一个length为7的数组,通过 6 次循环每次将一个最大值移动到后边来进行排序。public static void bubbleSort( int[] arr ) { //外循环控制趟数 for ( int i = 0 ; i < arr.length - 1 ...
2020-02-07 22:00:05
219
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅