树(下) 1.平衡二叉树 平衡因子:左子树和右子树的高度差; AVL树仍是二叉查找树,对任意结点其平衡因子绝对值不超过1 1.1 建树 class ANode { int value; ANode left; ANode right; int height;? public ANode(int va ...
分类:
其他好文 时间:
2021-04-20 15:38:51
阅读次数:
0
#基数排序 也是采用分桶的思想,但是加入了按位比较的思想(可以理解为每位进行一次计数排序) 思路: 计算数列中最大位数 按位数循环处理每位的排序 代码实现: #include<iterator> #include<iostream> #include<vector> using namespace ...
分类:
编程语言 时间:
2021-04-20 15:17:05
阅读次数:
0
package com.smile.test.sort.bubble; /** * 冒泡排序 时间复杂度O(n^2) */ public class Bubble { static void sort(Comparable[] a){ for (int i = a.length-1; i>0; i- ...
分类:
编程语言 时间:
2021-04-16 12:06:55
阅读次数:
0
###数组排序直接使用sort() var values = [0,3,2,15,16,10]; //sort()排序 升序或者降序 默认升序 values.sort(); //[0, 10, 15, 16, 2, 3] 发现结果并不是想要的 原因: //比较时会转换成字符串 比较的是ASCLL编码 ...
分类:
编程语言 时间:
2021-04-16 11:56:17
阅读次数:
0
//本模板是离散后对权值建树 #include<bits/stdc++.h> #define mid (l+r>>1) using namespace std; const int N=2e5+10; struct TR { int sum,lo,ro; }tr[N<<5]; int tr_cnt; ...
分类:
其他好文 时间:
2021-04-15 12:28:09
阅读次数:
0
1. 导航高亮 > {pboot:if('[nav:scode]'=='{sort:tcode}')}class="active"{/pboot:if} //用于非首页 例: {pboot:nav} <li {pboot:if('[nav:scode]'=='{sort:tcode}')}class ...
分类:
其他好文 时间:
2021-04-15 12:25:16
阅读次数:
0
# 1. 选择排序:循环找最小值,依次放在左侧 def select_sort(arr): for i in range(len(arr)-1): min_index = i for j in range(i+1, len(arr)): if arr[j] < arr[min_index]: min ...
分类:
编程语言 时间:
2021-04-15 12:18:58
阅读次数:
0
1. replace into介绍 MySQL REPLACE语句是SQL标准的扩展。MySQL REPLACE语句的工作方式如下: 第一步。在表中插入行,如果没有重复键错误,REPLACE的工作方式与INSERT语句类似。 第二步。如果由于出现重复键错误而导致插入失败: 从表中删除导致重复键错误的 ...
分类:
数据库 时间:
2021-04-14 11:59:45
阅读次数:
0
package stream import ( "log" "reflect" "sort" ) type ( // a Stream is where one can drain data from Stream chan interface{} // buffer stream BufferSt ...
7)错误票据 解题思路:考察的是在不知数据个数的前提下存储一个数组的方法,这里可以采用sstream库的优势,进行巧妙地转化,进而解决此题。 #include <iostream> #include <sstream> using namespace std; const int maxn = 10 ...
分类:
其他好文 时间:
2021-04-12 12:46:54
阅读次数:
0