
水塘采样
文章平均质量分 94
flyatcmu
这个作者很懒,什么都没留下…
展开
-
Linked List Random Node
Given a singly linked list, return a random node's value from the linked list. Each node must have thesame probabilityof being chosen.Follow up:What if the linked list is extremely large and its length is unknown to you? Could you solve this efficient..原创 2020-06-16 12:53:20 · 160 阅读 · 0 评论 -
Random Pick Index
Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note:The array size c原创 2016-10-27 11:19:03 · 391 阅读 · 0 评论 -
纪念一下第二个assignment 100分
感悟就是:坚持,才能从good到great。精益求精就是要不断打磨产品。Princeton的课就是好,一个作业可以牵扯到很多算法。复习了shuffle算法和Resevoir Sampling算法,还有linkedin,array implement deque,iterator的用法,确实不错的课程,经典就是经典!刷题不在乎刷题数目多少,而在于刷背后知识点的深度和广度。加油!我觉得我刷完A...原创 2019-03-29 08:54:32 · 211 阅读 · 0 评论