搜狗一面:
1、单聊表反转:
//非递归
public ListNode reverse(ListNode pHead){
ListNode pR = pHead;
ListNode p = pHead;
ListNode pPre = null;
while(p.next != null){
ListNode temp = p.next;
if(temp == null)
pR = p;
p.next = pPre;
pPre = p;
p = temp;
}
return pR;
}
//递归
public ListNode reverse(ListNode pHead){
if(pHead == null || pHead.next == null)
return pHead;
ListNode p = reverse(pHead);
pHead.next.next = pHead;
pHead.next = null;
return pHead;
}
2、网络分层OSI
应用层:HTTP DNS TELNET SMTP WWW FTP
表示层:ASII JPEG
会话层:SQL
传输层:TCP UDP
网络层:IP ARP RARP ICMP(因特网控制报文协议) RIP
数据链路层:PPP FR VLAN MAC
物理层:IEEE802.3 CLOCK
3、索引的应用:
索引适用于快速查找记录的一种数据结构,索引就像是数据库中数据的目录,数据库在查询时,首先在索引中找到匹配的值,然后根据这个匹配值找到对应的数据行。
在模糊查找中xxxxxx%会用到索引,%xxxxxxxx不会用到索引。
对于not in、not exists、!=等负向查询将不会使用索引。
每次查询只使用一个索引,如果where中使用索引,则order by中不会使用索引。
where子句中有多个查询条件的,可用复合索引。
MySQL只对< <= = > >= between in使用索引,需要注意in的范围。
union all 课使用索引。
列上进行类型转换的将不使用索引。
4、TCP三次握手、四次挥手