加粗不是重点,是我没答上来的
-
介绍一下项目(自己实验室课题,机器视觉方面的,这个面试官并不在意)
-
浏览器中输入一个URL,网页加载的过程和使用到的协议
-
http和https的区别,以及加密过程
- 追问:在https握手过程中,服务器给客户端发送证书,如何确定发送哪一个证书?
答:客户端在发送的时候会发送自己的SSL的版本吗 - 第二个追问没听明白。。。。
- 追问:在https握手过程中,服务器给客户端发送证书,如何确定发送哪一个证书?
-
上一个问题用到了IP协议,那么IP常用的路由协议有哪些?
答:没答上来
追问:那你觉得应该如何设计路由协议?
答:由于路由器之间形成的结构是图,将路由器自己的状态广播出去,最后形成一个图。。。大脑当时一片空白,想到啥回答啥。
找到哈工大课程的ppt如下:
链路状态路由算法:OSPF
距离向量路由算法:RIP
-
TCP如何保证可靠性?
答:三次握手,确认重传,滑动串口,拥塞控制(好像不是,面试官说还有么,我就说了这个),面试官提示还有校验码。 -
拥塞控制说一下?
追问:现在linux中的传输还是用这种方式么?答:不了解。
追问:还有其他的拥塞拥塞控制算法么?答:不了解
.BBR算法:BBR算法是个主动的闭环反馈系统,通俗来说就是根据带宽和RTT延时来不断动态探索寻找合适的发送速率和发送量。
追问:那你觉得判断网络拥塞的指标是什么?答:超过RTO时间没有收到确认(丢包)
**追问:到了默认时间是如何处理?答:丢包重传** **面试官:回去可以看一看具体的算法**
-
操作系统?答不是很熟,面试官换成了数据库
-
Mysql的常用存储引擎?
-
Inoodb和Myisam的区别
10.为了达到可重复读这个隔离级别,Innodb做了哪些?答的快照读 -
快照读底层是如何实现的?MVCC实现的
手撕算法:给一个链表,奇数位上升,偶数位下降,将链表排序成升序链表。例如1->6->2->4->3->2,排序后1->2->2->3->4->6 (当时没想出思路)
public class Test2 {
public static void main(String[] args) {
// Node head = new Node(1);
// head.next = new Node(8);
// head.next.next = new Node(3);
// head.next.next.next.next = new Node(6);
// head.next.next.next.next.next = new Node(5);
// head.next.next.next.next.next.next = new Node(4);
// head.next.next.next.next.next.next.next = new Node(7);
// head.next.next.next.next.next.next.next.next = new Node(2);
int[] nums = new int[]{1,8,3,6,5,4,7,2};
Node head = new Node(nums[0]);
Node cur = head;
for (int i = 1; i < nums.length; i++){
cur.next = new Node(nums[i]);
cur =cur.next;
}
Node[] nodelist = oddEvenList(head);
Node head1 = nodelist[0];
Node head2 = nodelist[1];
head2 = reverseListNode(head2);
Node dummy = merger(head1, head2);
cur = dummy;
while (cur != null) {
System.out.print(cur.val + " ");
cur = cur.next;
}
// System.out.println();
// cur = head2;
// while (cur != null) {
// System.out.print(cur.val + " ");
// cur = cur.next;
// }
}
public static Node reverseListNode(Node head){
Node pre = null;
Node cur = head;
while (cur != null) {
Node temp = cur.next;
cur.next = pre;
pre = cur;
cur = temp;
}
return pre;
}
public static Node merger(Node head1, Node head2) {
Node cur1 = head1;
Node cur2 = head2;
Node dummy = new Node(0);
Node cur = dummy;
while (cur1 != null && cur2 != null) {
if (cur1.val <= cur2.val) {
cur.next = cur1;
cur =cur.next;
cur1 = cur1.next;
} else {
cur.next = cur2;
cur = cur.next;
cur2 = cur2.next;
}
}
if (cur1 != null) {
cur.next = cur1;
}
if (cur2 != null) {
cur.next = cur2;
}
return dummy.next;
}
public static Node[] oddEvenList(Node head) {
Node slow = head;
Node fast = head.next;
Node dummy1 = slow;
Node dummy2 = fast;
while (slow.next != null && fast.next != null) {
slow.next = slow.next .next;
fast.next = fast.next.next;
slow = slow.next;
fast = fast.next;
}
if (fast != null) {
slow.next = null;
}
return new Node[]{dummy1, dummy2};
}
}
class Node {
int val;
Node next;
public Node(){};
public Node(int val) {
this.val = val;
}
}
手撕算法: k个一组反转链表
public ListNode reverseKGroup(ListNode head, int k) {
ListNode hair = new ListNode();
hair.next = head;
ListNode pre = hair;
while (head != null) {
ListNode tail = pre;
for (int i = 0; i < k; i++) {
tail = tail.next;
if (tail == null) return hair.next;
}
ListNode temp = tail.next;
ListNode[] listnode = reverseKLinkedList(head, tail);
head = listnode[0];
tail = listnode[1];
/**
连接子串
*/
pre.next = head;
tail.next = temp;
/**
要继续执行的推进步骤
*/
pre = tail;
head = tail.next;
}
return hair.next;
}
ListNode[] reverseKLinkedList(ListNode head, ListNode tail) {
ListNode pre = tail.next;
ListNode p =head;
while (pre != tail) {
ListNode temp = p.next;
p.next = pre;
pre = p;
p =temp;
}
return new ListNode[]{tail, head};
}