编辑
2023-10-26
英语学习
00

What makes students from elite schools special?

Every accomplished person I know had a mentor. Usually their parents, sometimes teachers or friends. Kids don't just start thinking "I want to go to MIT in 4 years, so I'd better start doing math contests, and getting research internships, and self-studying AP classes so I can take tests my school doesn't offer." Someone had to tell them those things existed, and that they could actually do them. Similarly, most kids don't think "I want to go work at a trading firm" or "I'm going to intern at Google my freshman year" until they go to a top school and see what their classmates are doing, and realize they can do the same things. This alone gives kids from top schools a huge advantage in the job market.

编辑
2023-10-26
英语学习
00

Why do you think CS has more job prospects than other majors?

编辑
2023-10-26
数据结构与算法
00

爬楼梯

cpp
class Solution { public: int climbStairs(int n) { if(n<=1) return n; vector<int>dp(n+1); dp[1]=1; dp[2]=2; for(int i=3;i<=n;i++) { dp[i] = dp[i-1]+dp[i-2]; } return dp[n];
编辑
2023-10-26
redis
00

按照官方文档的介绍,Redis所实现的是一种近似的LRU算法,每次随机选取一批数据进行LRU淘汰,而不是针对所有的数据,通过牺牲部分准确率来提高LRU算法的执行效率。

Redis内部只使用Hash表缓存了数据,并没有创建一个专门针对LRU算法的双向链表,之所以这样处理也是因为以下几个原因:

筛选规则,Redis是随机抽取一批数据去按照淘汰策略排序,不再需要对所有数据排序;

编辑
2023-10-25
mysql
00

什么是预读?

磁盘读写,并不是按需读取,而是按页读取,一次至少读一页数据(一般是4K),如果未来要读取的数据就在页中,就能够省去后续的磁盘IO,提高效率。