ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
> **今天挂了融360的java 开发心情有点不爽,还好15点小米的小哥哥贼棒;不多说直接小米面经奉上** --- 1. 面试官自我介绍(亲和度+1) 2. 反转流程,LZ自我介绍 3. Java 基础 ArrayList() LinkedList(); 4. JVM,JMM 5. GC算法 6. 标记清除算法,标记整理算法,复制算法的应用和区别,优缺点 7. MySQL的数据库引擎,索引类别和使用,最左原则,具体到题目。 数据库某个表三列 --- A | B | C ---|---|--- data_a1 |datab_1 |datac_1 data_a2 |datab_2 |datac_2 在A,B上加复合索引,在C上加了单独的索引。 --- * select * from table where A='1' and C='1'时调用哪个个索引。 - 调用A和C --- * select * from table where C='1' and A='1'时调用哪个个索引。 - 调用C 主要问的是最左原则,当然hash索引是不支持复合索引中的局部匹配的。 #### 两个数据结构的编程题: --- ###### 双栈实现队列: ```java class Queue { Stack<Integer> stack1 = new Stack<Integer>(); Stack<Integer> stack2 = new Stack<Integer>(); public void push(int node) { stack1.push(new Integer(node)); } public int pop() { int pop; while (!stack1.isEmpty()) { stack2.push(stack1.pop()); } pop = stack2.pop().intValue(); while (!stack2.isEmpty()) { stack1.push(stack2.pop()); } return pop; } } ``` --- ###### 最小堆 --- ```java public class MinHeap { private int[] data; public MinHeap(int[] data) { this.data = data; } public void createHeap() { for (int i = (data.length) / 2 - 1; i >= 0; i--) { heapIfy(i); } } public void heapIfy(int value) { int lchild = left(value); int rchild = right(value); int smallest = value; if (lchild < data.length && data[lchild] < data[value]) smallest = lchild; if (rchild < data.length && data[rchild] < data[smallest]) smallest = rchild; if (value == smallest) return; swap(value, smallest); heapIfy(smallest); } public int left(int value) { return ((value + 1) *2) - 1; } public int right(int value) { return (value + 1) *2; } public void swap(int i, int j) { int tmp = data[i]; data[i] = data[j]; data[j] = tmp; } public static void main(String[] args) { int[] value = {1,3,7,22,1,6,4}; MinHeap heap = new MinHeap(value); heap.createHeap(); for (int i = 0; i < value.length; i++) { System.out.print(heap.data[i] + " "); } } } ```