<?php #基数排序,此处仅对正整数进行排序,至于负数和浮点数,需要用到补码,各位有兴趣自行研究 #计数排序 #@param $arr 待排序数组 #@param $digit_num 根据第几位数进行排序 function counting_sort(&$arr, $digit_num = fa ...
分类:
编程语言 时间:
2020-06-16 23:31:04
阅读次数:
80
/* 直接选择排序 */ func straightSelectionSorter(array []int) { for i := 0; i < len(array)-1; i++ { k := i for j := i + 1; j < len(array); j++ { if array[k] ...
分类:
编程语言 时间:
2020-06-16 23:05:15
阅读次数:
62
# list.sort方法和内置函数sorted # list.sort方法会就地排序列表,也就是说不会把原列表复制一份.这也是这个方法的返回值是None的原因,提醒你本方法不会新建一个列表. # 在这种情况下返回None其实是Python的一个惯例: 如果一个函数或者方法对对象进行的是就地改动,那 ...
分类:
其他好文 时间:
2020-06-16 20:38:31
阅读次数:
69
gitlab代码统计 git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --since ==2018–03-01 ...
分类:
其他好文 时间:
2020-06-16 18:21:45
阅读次数:
298
【转-整理】 JAXB注解 @XmlRootElement 及XML文件解析详解 Java代码 @Retention(value=RUNTIME) @Target(value=TYPE) public @interface XmlRootElement @Inherited @Retention(v ...
分类:
其他好文 时间:
2020-06-16 01:18:25
阅读次数:
83
1035 插入与归并 (25分) 数据比较小,归并不用写合并函数,直接sort 中间序列不包括初始序列 #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> ...
分类:
编程语言 时间:
2020-06-15 10:10:59
阅读次数:
53
func merge(left,right []int) (result []int) { r,l := 0,0 for l < len(left) && r < len(right) { if left[l] < right[r]{ result = append(result,left[l]) ...
分类:
编程语言 时间:
2020-06-14 19:03:35
阅读次数:
62
java数组排序详细讲解 前言: 几种常用的JAVA数组排序方法的整合。 java数组排序 法一:Arrays.sort() Arrays.sort()排序方法在java中是最简单且最常用的排序方法 int []arr1= {45,34,59,55}; Arrays.sort(arr1);//调用方 ...
分类:
编程语言 时间:
2020-06-14 18:49:51
阅读次数:
51
哈希表 思路 遍历数组arr,并用map记录各元素出现的次数 根据map的key把对应的value提出 并保存在数组val中。(KeySet()获取map中所有的key) 遍历排序后的数组val,同时与k比较,更新k的值 代码 //55ms public static int findLeastNu ...
分类:
其他好文 时间:
2020-06-14 17:01:04
阅读次数:
54
链接:https://leetcode-cn.com/problems/4sum/ 代码 class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> ans = n ...
分类:
其他好文 时间:
2020-06-13 21:04:30
阅读次数:
53