1、排序 L.sort(reverse=False) 参数:缺省参数,非必选 作用:默认升序,即由小到大。需要降序时,加上参数reverse=True 返回值:返回排序后的列表L。不能用变量接收,列表L已经是排序后的了 2、追加单个元素 L.append(arg) 参数:必选参数,为空会报错 作用: ...
分类:
编程语言 时间:
2020-04-28 12:56:27
阅读次数:
79
static bool cmp(pair<char, int> a , pair<char,int> b) { return a.second>b.second; //按照value从大到小重新排序 } string frequencySort(string s) { unordered_map<c ...
分类:
编程语言 时间:
2020-04-27 22:52:06
阅读次数:
131
1 // 2 // Created by Arc on 2020/4/27. 3 //对了,这篇题解的代码是小白自己写的.有啥错误还请各位大佬多多包涵. 4 5 /* 6 * 某国有一条大河(一条大河~~~~,波浪宽~~~~),河有笔直的南北两岸,岸上各有位置不相同的n个城市 7 * 北岸的每个城市 ...
分类:
其他好文 时间:
2020-04-27 17:36:35
阅读次数:
54
1、选择排序 1 public class SelectSort<T extends Comparable> { 2 3 public void sort(T[] arr) { 4 if (arr != null && arr.length > 1) { 5 for (int i = 0; i < ...
分类:
编程语言 时间:
2020-04-27 11:42:40
阅读次数:
54
package com.company;import java.util.Arrays;//冒泡排序public class dome { public static void main(String[] args) { int[] a ={1,7,2,4,3,6,8,5}; int[] sort ...
分类:
编程语言 时间:
2020-04-27 10:03:43
阅读次数:
59
之前写过一个文章。 利用python画出SJF调度图 动态高度优先权优先调度 动态优先权调度算法,以就绪队列中各个进程的优先权作为进程调度的依据。各个进程的优先权在创建进程时所赋予,随着进程的推进或其等待时间的增加而改变。进程的优先权利用某一范围内的整数来表示。有的系统数值越小优先权越高,如Unix ...
分类:
编程语言 时间:
2020-04-26 18:58:57
阅读次数:
77
马踏棋盘算法 马踏棋盘算法介绍和游戏演示: 马踏棋盘游戏代码实现: 对第一种实现方式的思路图解: 代码实现: ...
分类:
编程语言 时间:
2020-04-26 14:07:56
阅读次数:
85
Problem Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum ...
分类:
其他好文 时间:
2020-04-26 12:31:47
阅读次数:
51
(一)Stream 好用 @Overridepublic List<CategoryEntity> listWithTree() { //1 查出所有分类 List<CategoryEntity> categoryEntities = baseMapper.selectList(null); //2 ...
分类:
其他好文 时间:
2020-04-25 23:50:21
阅读次数:
151
```javascript // 对普通数组进行排序 let nums = [1, 3, 4, -4, 2, 5, 1]; nums.sort(function (a, b) { // 升序 // return a - b; //降序 return b - a; }); console.log(nu... ...
分类:
编程语言 时间:
2020-04-25 23:48:29
阅读次数:
80