小红书面试 如何判断单链表有环
1public boolean IsLoop(Node head){ 2 Node fast = head; 3 Node slow = head; 4 if(head = null){ 5 return false; 6 } 7 8 while(fast != null&& slow != null){ 9 fast = fast.next.next; 10 slow = slow.next; 11 if(fast = slow){ 12 return true; 13 } 14 } 15 16 return false; 17} 三次握手, 为什么要三次
A -> B SYN=1, seq = x;
A <- B SYN = 1, ACK=1, seq = y, ack = x+1;