红黑树相关
-
知道红黑树三大特点:1.是平衡二叉树(默认就是排序的)2.黑高要相同 3.红有子,必为黑
-
二叉平衡树的前驱节点和后续节点是按照排序的顺序定义的。
-
红黑树的删除规则与平衡二叉树的删除规则相同:本质上是找前驱节点或者是后继节点删除对于一个节点分三种节点删除—1.叶子节点直接删除 2. 只有一个子节点,用子节点替换 3.有两个子节点,找前驱或者后驱
-
删除之后,红黑树还要进行修复。分两大种情况:1.删除的是红节点,不用修复 2. 删除的是黑节点又要分情况讨论
关于笔试相关
美的
选择加编程两道,第二道编程挺简单的,第一道是判断一堆坐标当中能落在一条直线上的最大点数个数(这个关键在于找三个以上点在直线上的情况,因为任意两点总是成线,最后a了0.7),a了1.7直接交了。
金蝶
挺简单的,没编程题你敢信。。。。。
美团
五道编程题,菜鸡如我没一道全a。。。。。最高只a了0.5。寄!
1.买商品的折扣与满减选择
2.解码
3.
4.
5.魔法盒子
import java.util.HashSet;
import java.util.Scanner;
/*
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
*/
/*String products_count = scan.nextLine();
String products_price = scan.nextLine();
String account_price = scan.nextLine();*//*
String a = scan.nextLine();
String b = scan.nextLine();
String[] tmp = a.split(" ");
int c = 0;
int d = 0;
c = Integer.parseInt(tmp[1]);
d= Integer.parseInt(tmp[2]);
char[] chars = b.toCharArray();
System.out.println("hhhaaa");
}
public static String jiemi(int m , int n , char[] chars){
StringBuilder sb = new StringBuilder();
return sb.toString();
}
}
*/
/*public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
int c = scan.nextInt();
int[] d1= new int[b];
int[] d2 = new int[b];
int[] e1= new int[c];
int[] e2 = new int[c];
for(int i = 0 ; i < b ; i++){
d1[i] = scan.nextInt();
}
for(int i = 0 ; i < b ; i++){
d2[i] = scan.nextInt();
}
for(int i = 0 ; i < c ; i++){
e1[i] = scan.nextInt();
}
for(int i = 0 ; i < c ; i++){
e2[i] = scan.nextInt();
}
HashSet<Integer> hashSet = new HashSet<>();
for(int i = 0 ; i < b ; i ++){
int x = d2[i] - d1[i]+1;
for(int j = 0; j < x ; j++){
hashSet.add(d1[i]+j);
}
}
int count = 0;
for(int i = 0 ; i < c ; i ++){
int x = e2[i] - e1[i]+1;
for(int j = 0; j < x ; j++){
if(hashSet.contains(e1[i]+j)) count++;
}
}
System.out.print(count);
}
}*/
/*public class Main {
//输入两行数据第一行 m , n 其中m是初始数组 n是计算次数
//现规定计算(m+1)*m*(m+2)的定义如下:输入一个数组m,加号意味着m中每个数+1,而*号意味着将两个数组按顺序拼接
//例如输入2 1
//输出 [3 2 4]
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int[] a = new int[1];
a[0] = scan.nextInt();
int index = scan.nextInt();
System.out.println(mofa(a,index));
}
//直接循环
public static int[] mofa2(int[] a, int index){
}
//递归
public static int[] mofa(int[] pre ,int index){
//index = 0 ;
//不需要上层提交!!! 向下层提交
for(int i = 0 ; i < pre.length*3 ; i++){
if(i < pre.length){
res[i] = pre[i% pre.length]+1;
}else if(i >= pre.length && i< pre.length*2){
res[i] = pre[i% pre.length];
}else{
res[i] = pre[i% pre.length]+2;
}
}
}
}*/
算法研究相关
递归
- 了解递归位置带来的影响,想象成穿过几层纸,有些操作是穿入一层纸之前做的(对应方法参数),而有些则是穿出之前做的(对应返回结果):想象斐波那契数列,穿入之前参数减一,穿出之前对返回值相加,并返回。
动态规划
- 知道什么情况下使用动态规划而不是靠感觉判断:有代价和获利两个要素
- 知道动态规划的二维dp表与一维dp表
- 知道解决动态规划的三步走:确定dp表定义,状态转移公式,编码实现