Skip to content

算法训练营第二周作业 #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GeekUniversity opened this issue Apr 19, 2019 · 189 comments
Open

算法训练营第二周作业 #52

GeekUniversity opened this issue Apr 19, 2019 · 189 comments

Comments

@GeekUniversity
Copy link
Contributor

GeekUniversity commented Apr 19, 2019

本周重点学习知识点

跳表、散列表、哈希算法、二叉树、红黑树

要求

  1. 每周至少完成给定题目中的两道算法题
  2. 围绕每周重点学习的算法知识点,撰写一篇有观点和思考的技术文章(字数不限)

注意事项

  1. 下面列出的题目中,按照知识点进行了简单分类,但并不意味着使用相应的数据结构或算法一定是解决该题目的最优解,这样分类只是为了方便大家有针对性的练习;
  2. 有的题目可能需要结合多个算法或数据结构进行求解。

第二周题目

哈希表

简单:https://leetcode-cn.com/problems/valid-anagram/
中等:https://leetcode-cn.com/problems/top-k-frequent-words
中等:https://leetcode-cn.com/problems/find-duplicate-file-in-system/
困难:https://leetcode-cn.com/problems/substring-with-concatenation-of-all-words/
困难:https://leetcode-cn.com/problems/number-of-atoms/

二叉树

简单:https://leetcode-cn.com/problems/second-minimum-node-in-a-binary-tree/
中等:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/
中等:https://leetcode-cn.com/problems/all-nodes-distance-k-in-binary-tree/
困难:https://leetcode-cn.com/problems/count-of-smaller-numbers-after-self/
困难:https://leetcode-cn.com/problems/binary-tree-maximum-path-sum/

二叉搜索树

简单:https://leetcode-cn.com/problems/minimum-distance-between-bst-nodes/
中等:https://leetcode-cn.com/problems/range-sum-of-bst/
中等:https://leetcode-cn.com/problems/contains-duplicate-iii/
困难:https://leetcode-cn.com/problems/count-of-range-sum/
困难:https://leetcode-cn.com/problems/count-of-smaller-numbers-after-self/

作业提交规则

  1. 在提交作业之前,请先阅读这里的 README 文档:https://github.com/algorithm001/algorithm/blob/master/README.md
  2. 然后在此 Issues 下按照如下格式回复:
  1. 学号 + GitHub Username
  2. 作业代码的 GitHub 链接(填写自己仓库下对应的作业链接即可,同时记得给本仓库提交 pull request)
  3. 发表自己本周的学习感言 issues,并提交链接,issues 标题格式:“【学号后三位-week2】+文章标题”,格式参考:示例:【000-week1】关于二分查找的一些新的理解 #9
@GeekUniversity GeekUniversity pinned this issue Apr 22, 2019
@SherryShi0108
Copy link

学号:086 username:SherryShi0108
第二周作业链接:https://github.com/SherryShi0108/algorithm/tree/master/Week_02/id_86
学习感言:#295

@songsmith
Copy link

songsmith commented Apr 25, 2019

学号:137 Username:songsmith
第二周作业链接:https://github.com/songsmith/algorithm/tree/master/Week_02/id_137
学习感言: #300

@suncen0505
Copy link

学号:126 Username:suncen0505
第二周作业链接:https://github.com/suncen0505/algorithm/tree/master/Week_02/id_126
学习感言: #302

@shimmer236
Copy link
Contributor

学号:062 username:shimmer236
第二周作业链接:https://github.com/shimmer236/algorithm/tree/qq/Week_02/id_62
学习感言:#304

@honeyaya
Copy link
Contributor

学号:150 username:honeyaya
第二周作业链接:#305
学习感言:#null

@otkinlife
Copy link

学号:061 username:otkinlife(贾凯超)
第二周作业链接:https://github.com/otkinlife/algorithm/tree/master/Week_02/id_61
学习感言:#307

@Maybrittnelson
Copy link

学号:116 username:Maybrittnelson
第二周作业链接:https://github.com/Maybrittnelson/algorithm/tree/master/Week_02/id_116
学习感言:#308

@suncen0505
Copy link

学号:086 username:SherryShi0108
第二周作业链接:https://github.com/SherryShi0108/algorithm/tree/master/Week_02/id_86
学习感言:#295

我这有个疑问,就是为什么要减少return 呢?我倒觉得没必要的时候,直接return ,省去后续的处理,不是更好吗

@suncen0505
Copy link

学号:116 username:Maybrittnelson
第二周作业链接:https://github.com/Maybrittnelson/algorithm/tree/master/Week_02/id_116
学习感言:#308

我也做了几道树的题目,总体也是磕磕绊绊的,但是我的思路是 先把需要的步骤大概列出来,然后再填充临界条件,退出条件,递归条件

@suncen0505
Copy link

学号:061 username:otkinlife(贾凯超)
第二周作业链接:https://github.com/otkinlife/algorithm/tree/master/Week_02/id_61
学习感言:#307

总结的挺好的,可以多换集中解题技巧,比如我的可能是先把需要的步骤大概列出来,然后再填充临界条件,退出条件,递归条件

@suncen0505
Copy link

学号:137 Username:songsmith
第二周作业链接:https://github.com/songsmith/algorithm/tree/master/Week_02/id_137
学习感言: #300

我做第一个二叉树的题的时候,也卡壳了 ,还是觉得二叉树没有屡清楚,后续慢慢把树的特征画图出来,慢慢一点一点解,发现还是挺有趣的

@suncen0505
Copy link

学号:062 username:shimmer236
第二周作业链接:https://github.com/shimmer236/algorithm/tree/qq/Week_02/id_62
学习感言:#304

字符串的那个题我觉得挺好玩,我用的是hash存储,但是更优化的解题思路是 字符-a作为数组的下标,我觉得这种方法太秒了,哈哈,也可以收录到你的内容里去

@jianghaoyuan2007
Copy link
Contributor

学号:038 Username:jianghaoyuan2007
第一周作业链接:https://github.com/jianghaoyuan2007/algorithm/tree/master/Week_02/id_38
学习感言: #311

@FollowMyHeart
Copy link
Contributor

学号:033 Username: FollowMyHeart
第二周作业链接:https://github.com/FollowMyHeart/algorithm/tree/master/Week_02/id_33
学习感言:#316

@FollowMyHeart
Copy link
Contributor

学号:137 Username:songsmith
第二周作业链接:https://github.com/songsmith/algorithm/tree/master/Week_02/id_137
学习感言: #300

Python语言中变量跟None比较相等是不是应该用is?

@aiter
Copy link

aiter commented Apr 26, 2019

学号:014 Username: aiter
第二周作业链接(java):https://github.com/aiter/algorithm/tree/master/Week_02/id_14
学习感言: #318

@liutong-cnu
Copy link
Contributor

学号:144 Username:liutong
第二周作业链接:https://github.com/liutong-cnu/algorithm/tree/master/Week_02/id_144
学习感言:null

@IMC666
Copy link
Contributor

IMC666 commented Apr 27, 2019

@AHaoPang
Copy link
Contributor

学号:009 Username:AHaoPang
第二周作业链接:https://github.com/AHaoPang/algorithm/tree/master/Week_02/id_9
学习感言:#323

@zouyingjie
Copy link
Contributor

学号:001 Username:zouyingjie
第二周作业链接:https://github.com/zouyingjie/algorithm/tree/master/Week_02/id_1
学习感言:#324

@v1xingyue
Copy link
Contributor

@yuanyunxu
Copy link
Contributor

学号: 122
UserName : yuanyunxu
第二周作业链接:https://github.com/yuanyunxu/algorithm/tree/master/Week_02/id_122
学习总结: #329

@yxs354
Copy link
Contributor

yxs354 commented Apr 27, 2019

学号: 044
UserName : yxs354
第二周作业链接:https://github.com/yxs354/algorithm/tree/master/Week_02/id_44
学习总结: #330

@HongChao6
Copy link
Contributor

学号:137 Username:songsmith
第二周作业链接:https://github.com/songsmith/algorithm/tree/master/Week_02/id_137
学习感言: #300

Python语言中变量跟None比较相等是不是应该用is?

== 是对内容的判断; is 是对 id 的判断
Python 中所有的 None 值的 id 都是一样的

用 is 会更好一些,速度比 == 要快,因为 == 要运行查找和比较函数

@HongChao6
Copy link
Contributor

学号:086 username:SherryShi0108
第二周作业链接:https://github.com/SherryShi0108/algorithm/tree/master/Week_02/id_86
学习感言:#295

看到你用 python 写的 '242.有效的字母异位词' 第二种方法是 调用排序函数 然后直接判断相等,不禁感叹前人栽树 后人乘凉
671题,可以考虑将 '最小值' 这个参数去掉,减少一点空间;方式:给PDFS函数增加第二个参数minVal(引用形式),然后将 root.val 最为初始值传入

@HongChao6
Copy link
Contributor

学号:137 Username:songsmith
第二周作业链接:https://github.com/songsmith/algorithm/tree/master/Week_02/id_137
学习感言: #300

你这不是在LeetCode上做的吧,创建了256个空间的数组,在比较字母种类不多的情况下,变成稀疏数组了,且 题目中只要求比较小写字母,你用26个空间的数组即可

@HongChao6
Copy link
Contributor

学号:126 Username:suncen0505
第二周作业链接:https://github.com/suncen0505/algorithm/tree/master/Week_02/id_126
学习感言: #302

从二叉树中找到 第二小值 的节点 题,我是创建了一个私有变量用于保存第二小的值

@yuqiu-pp
Copy link
Contributor

学号:006 Username:yuqiu-pp
第二周作业链接:https://github.com/yuqiu-pp/algorithm/tree/master/Week_02/id_6
学习感言:#466

@DevinSu
Copy link
Contributor

DevinSu commented Apr 28, 2019

学号:091 username:籍东文
https://github.com/DevinSu/algorithm/tree/master/Week_02/id_91
学习感言 #359

@hfcc8685
Copy link

学号: 071; GitHub Username: hfcc8685
作业代码的 GitHub 链接: https://github.com/hfcc8685/algorithm/tree/master/Week_02/id_71
学习感言: #468

@Hermancg
Copy link
Contributor

学号:088 username: Hermancg
第二周作业链接:https://github.com/Hermancg/algorithm/tree/master/Week_02/id_88
学习感言:#464

@zsndev
Copy link
Contributor

zsndev commented Apr 28, 2019

学号:012 username: hijkoo
第二周作业链接:https://github.com/hijkoo/algorithm/tree/master/Week_02/id_12
学习感言:#348

@yuzewang
Copy link
Contributor

学号:136 Username:yuzewang
第二周作业链接:https://github.com/songsmith/algorithm/tree/master/Week_02/id_136
学习感言: #471

@ellie88
Copy link
Contributor

ellie88 commented Apr 28, 2019

学号:094 Username: ellie88
第二周作业链接: https://github.com/ellie88/algorithm/tree/master/Week_02/id_94
学习感言:#472

@taolei0108
Copy link
Contributor

学号:054 Username: taolei0108
第二周作业链接: https://github.com/taolei0108/algorithm/tree/master/Week_02/id_54
学习感言:#474

@mikejicken
Copy link

学号:41 Username:mikejacken
第二周作业链接:https://github.com/mikejicken/algorithm/tree/master/Week_02/id_41

学习感言:#473

@zyterence
Copy link
Contributor

学号:17 Username:zyterenec
第二周作业:https://github.com/zyterence/algorithm/tree/master/Week_02/id_17

@Uriah6140
Copy link

学号:008 username:Uriah
第二周作业链接:https://github.com/Uriah6140/algorithm/tree/id_08_homework/Week_02/id_8
学习感言:null

@xiangfeifei54
Copy link

学号:077 username:xiangfeifei
作业:id_77
学习感言:【077-week2】第二周学习总结

@HongChao6
Copy link
Contributor

HongChao6 commented Apr 29, 2019 via email

@gaoshengnan
Copy link
Contributor

学号:054 Username: taolei0108
第二周作业链接: https://github.com/taolei0108/algorithm/tree/master/Week_02/id_54
学习感言:#474

总结的挺好的

@gaoshengnan
Copy link
Contributor

学号:81 username:abinbao
第二周作业链接:https://github.com/abinbao/algorithm-1/tree/master/Week_02/id_81
学习感言:#454

写的挺详细的~

@gaoshengnan
Copy link
Contributor

学号:077 username:xiangfeifei
作业:id_77
学习感言:【077-week2】第二周学习总结

总结的很好,很详细

@gaoshengnan
Copy link
Contributor

学号:006 Username:yuqiu-pp
第二周作业链接:https://github.com/yuqiu-pp/algorithm/tree/master/Week_02/id_6
学习感言:#466
看你的总结学习到了很多东西
学习到了,

@gaoshengnan
Copy link
Contributor

学号:012 username: hijkoo
第二周作业链接:https://github.com/hijkoo/algorithm/tree/master/Week_02/id_12
学习感言:#348

写的挺好的!

@GeekUniversity GeekUniversity unpinned this issue Apr 29, 2019
@AndroidQin
Copy link
Contributor

学号:095 username:AndroidQin
第二周作业链接:https://github.com/AndroidQin/algorithm/tree/master/Week_02/id_95
学习感言:#477

@yush-jiang
Copy link

yush-jiang commented May 5, 2019

学号:103 username:JYSDeveloper
第二周作业链接:代码
学习感言:链接

@1005419213zxf
Copy link
Contributor

学号:115 username:1005419213zxf
第二周作业链接:https://github.com/algorithm001/algorithm/tree/master/Week_02/id_115
学习感言:#378

@yimeng
Copy link
Contributor

yimeng commented May 14, 2019

学号:128 username:yimeng
第二周作业链接:https://github.com/yimeng/algorithm/tree/master/Week_02/id_128
学习感言:#438

@bin-albin
Copy link
Contributor

bin-albin commented May 14, 2019 via email

@wwb4694376
Copy link

学号:132 Username:wwb4694376
第二周作业链接:https://github.com/wwb4694376/algorithm/tree/master/Week_02/id_132
学习感言:#790

@Fanlu91
Copy link
Contributor

Fanlu91 commented May 17, 2019

作业补交(第二周时没有及时补充学习感言内容)
学号:026
UserName:Fanlu91
第二周作业链接:https://github.com/Fanlu91/algorithm/tree/master/Week_02/id_26
学习感言:#380

@zhangtianwang
Copy link

作业补交
学号:120
UserName:zhangtianwang
第二周作业链接:https://github.com/zhangtianwang/algorithm/tree/master/Week_02/id_120
学习感言:#828

@361028096
Copy link

361028096 commented May 18, 2019

学习总结补交
学号:053 username:361028096
第二周作业链接:https://github.com/361028096/algorithm/tree/master/Week_02/id_53
学习感言:#829

@flowbywind
Copy link
Contributor

作业补交
学号:104,username:flowbywind
第二周作业链接:https://github.com/flowbywind/algorithm/tree/master/Week_02/id_104
学习感言: #867

@lcfgrn
Copy link

lcfgrn commented May 19, 2019

学号:020 Username:lcfgrn
第二周作业链接:https://github.com/lcfgrn/algorithm/tree/master/Week_02/id_20
学习感言:#894 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests