🍻 cs
- 🍥 Interview
- Data Structure
- python手写> https://github.com/tobgu/pyrsistent
- 更快的list > https://github.com/DanielStutzbach/blist
- List/Dynamic Array:
- Python List/Dynamic Array 的底层实现原理:
- Linked List:
- 教学:
- 现实运用:
- Consider the history section of web browsers, where it creates a linked list of web-pages visited, so that when you check history (traversal of a list) or press back button, the previous node's data is fetched.
- One common sighted example is low level memory management (i.e. the heap as managed by malloc in C or new in Java, etc) is often implemented as a linked list, with each node representing a used or available (free) block of memory. These blocks may be of any size, change size (combine and split), be freed or assigned in any order, and reordered. A linked list means you can keep track of all of these "nodes" and manipulate them fairly easily.
- Also, Hashtables that use chaining to resolve hash collisions typically have one linked list per bucket for the elements in that bucket.
- A simple real life example is a Train, here each coach is connected to its previous and next coach (Except first and last). In terms of programming consider coach body as node value and connectors as links to previous and next nodes.
- Our brain is also a good example of linked list. In the initial stages of learning something by heart, the natural process is to link one item to next. It's a subconscious act. Also, when we forget something and try to remember, than our brain follows association and tries to link one memory with another and so on and we finally recall the lost memory.
- E.g. Consider the thinking process when you placed your bike key somewhere and couldn't remember.
- Another real life example could a be queue/line of persons standing for food in mess, insertion is done at one end and deletion at other. And these operations happen frequent. dynamic queues / stacks are efficiently implemented using linkedlists.
- As a practical example, consider following situation.
- A company maintains details of customers. A customer X can bring other customers that can joins list of customers just after X. A customer after X can also leave any time. The only operation that company does is print list of all customers.
- 优势:
- 链接: https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/QUaUd/in-the-real-world-lists-vs-arrays
- [MUSIC] Why would you want to use a list rather than an array?
- The big advantage of an array is random access. You can look at any element of the array in the same amount of time. So reading an array is constant time. It's o over one.
- In a list, you have to walk down the list step by step to get to the element you want.
- So reading in a list is linear time. It's o of n. On the other hand, inserting or deleting an item in a list, just requires fiddling some object references. So, it's constant time. But inserting or deleting into an array usually means you have to copy all of the following items in the array. Sometimes you have to copy the whole array if you don't have enough space in memory so that's o of n. In general, arrays are faster to read, and lists are faster to write. So you have to pick your data structure carefully depending on what algorithm you're planning on using with it.
- For example, there was a time when I needed to do a merge sort on a collection of very large objects.
- Merging two arrays means allocating a third array as big as the original two combined, and then copying each object into it. So it's really slow. Merging two lists means walking down the two lists and just fiddling the references as you go. And when you're done you have one big list. So that's really fast. In this case the algorithmic complexity is the same. They're both n log n, like any merge sort. But in practice, the difference in performance was something like 10 or 20 times, because copying the objects took such a long time. So using a list was a big win.
- 劣势:
- why you should avoid linked lists (video): https://www.youtube.com/watch?v=YQs6IC-vgmo
- CS Doji:
- 链接: https://www.youtube.com/watch?v=WwfhLC16bis
- 基础教学:
- 基本:
- 代码实现
- 然后举了个例子
- 基本:
- VJ's Medium
- Part 1: https://bit.ly/2tju7Hl
- Part 2: https://bit.ly/2joqxFS
- Code School:
- 链接:https://www.youtube.com/watch?v=NobHlGUjV3g
- Linked List Vs. Array:
- Memory
- Array Memory问题:C/C++里,因为需要提前设置开辟空间,如果要增加已经定义空间的Size,会对底层的Memory造成影响,如图下:
- 图中array A如果从Size = 4, 也就是16bytes, 增加到Size = 5,就必须在Memory里面开辟出新的 4bytes * 5 = 20 bytes的空间:
- 图中array A如果从Size = 4, 也就是16bytes, 增加到Size = 5,就必须在Memory里面开辟出新的 4bytes * 5 = 20 bytes的空间:
- Linked List Memory操作的优势显现出来了:
- Node的Memory随机分配,如果Insert新Node,仅需在Memory开辟新空间,然后把之前的Tail指向这片空间。
- Node的Memory随机分配,如果Insert新Node,仅需在Memory开辟新空间,然后把之前的Tail指向这片空间。
- Array Memory问题:C/C++里,因为需要提前设置开辟空间,如果要增加已经定义空间的Size,会对底层的Memory造成影响,如图下:
- Insertion:
- Linked List O(1):但这两个需要讲清楚,因为Insert建立在找到Insertion point
- 所以假如Search也经常使用,Linked List相对Array并无优势:
- Any application where insertions and deletions happen regularly, search is not a regular operation and elements are always traversed one by one.
- Linked List O(1):但这两个需要讲清楚,因为Insert建立在找到Insertion point
- Memory
- 现实运用:
- 待实现:
- 代码实现
- implement (I did with tail pointer & without):
- size() - returns number of data elements in list
- empty() - bool returns true if empty
- value_at(index) - returns the value of the nth item (starting at 0 for first)
- push_front(value) - adds an item to the front of the list
- pop_front() - remove front item and return its value
- push_back(value) - adds an item at the end
- pop_back() - removes end item and returns its value
- front() - get value of front item
- back() - get value of end item
- insert(index, value) - insert value at index, so current item at that index is pointed to by new item at index
- erase(index) - removes node at given index
- value_n_from_end(n) - returns the value of the node at nth position from the end of the list
- reverse() - reverses the list
- remove_value(value) - removes the first item in the list with this value
- implement (I did with tail pointer & without):
- 代码研究:
- 课件准备:
- 网盘 : /Users/yui/Movies
- Google University 的LinkedList
- Linked Lists
- Description:
- Singly Linked Lists (video): https://www.coursera.org/learn/data-structures/lecture/kHhgK/singly-linked-lists
- CS 61B: https://archive.org/details/ucberkeley_webcast_htzJdKoEmO0
- Linked List vs Arrays:
- Core Linked Lists Vs Arrays: https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/rjBs9/core-linked-lists-vs-arrays
- In The Real World Linked Lists Vs Arrays (video): https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/QUaUd/in-the-real-world-lists-vs-arrays
- Gotcha: you need pointer to pointer knowledge: (for when you pass a pointer to a function that may change the address where that pointer points) This page is just to get a grasp on ptr to ptr. I don't recommend this list traversal style. Readability and maintainability suffer due to cleverness.
- Pointers to Pointers: https://www.eskimo.com/~scs/cclass/int/sx8.html
- Doubly-linked List
- Description (video): https://www.coursera.org/learn/data-structures/lecture/jpGKD/doubly-linked-lists
- No need to implement
- Description:
- Linked Lists
- 中文资源:
- 代码实现
- 稿子:
- 教学:
- Algorithm
- 数据结构和算法的基础实现:
- 算法总结:
- 二分:
- System Design
- 如何选择DB:https://www.youtube.com/watch?v=v5e_PasMdXc
- 领域扫盲:
- 实战问题:
- Engineering Blog
- Dropbox:
- md到http的转换器:https://github.com/dropbox/mdwebhook
- API设计原理:https://github.com/oldratlee/translations/blob/master/api-design-principles-from-qt/README.md
- Don't Do: https://hackernoon.com/how-not-to-design-netflix-in-your-45-minute-system-design-interview-64953391a054
- 500行代码实现项目搭建: http://aosabook.org/en/index.html
- 设计Redis:http://origin.redisbook.com
- 设计RESTful API: https://github.com/aisuhua/restful-api-design-references
- 设计Compiler: https://github.com/jamiebuilds/the-super-tiny-compiler
- 设计DB:http://www.open-open.com/code/view/1421500691156
- 后端架构:https://github.com/xingshaocheng/architect-awesome
- 面试准备:
- 公司申请:
- --------------------------
- https://breakoutlist.com
- http://www.mitbbs.com/article_t2/JobHunting/32889697.html
- https://blog.wealthfront.com/2016-career-launching-companies-list/
- http://www.indeed.com/
- http://promotion.monster.com/
- http://www.1point3acres.com/bbs/forum-28-1.html
- http://www.mitbbs.com/bbsdoc/JobHunting.html
- https://www.careercup.com/
- https://www.glassdoor.com/index.html
- --------------------------
- 公司Tier:
- Tier 1: Dropbox, Square, Pinterest, Facebook, LinkedIn, Google, Twitter, Apple
- Tier 2: Amazon, Micriosoft, Yelp, Netflix, Skype, VMWare, Salesforce, Groupon, Paypal, Evernote, Box.net, Quora, A9.com, 126Lab, Palantir
- Tier 3: Oracle, EMC, eBay, Intuit, NetApp, NetSuite, Yahoo, Adobe, Autodesk, Symantec, Riverbed, Quantcast, Concur, Aster Data, Citrix, EA, Expedia, RedHat, RackSpace, Akamai, Bloomberg
- w
- 软实力:
- 其他可能遇到的问题:
- 面试过程:
- 公司申请:
- Data Structure
- 🍥 Python代码提高
- Python进阶
- 电子书资源:http://www.allitebooks.com
- 功能:
- python testing: Typing Hiting
- Standford Programming Paradigms:
- Python Fucntional Programming特性:
- Coding Style:
- 练手项目:https://www.zhihu.com/question/29372574/answer/88744491
- python 用法cheatsheet:https://www.pythonsheets.com/
- python一些鲜为人知的东西:https://github.com/satwikkansal/wtfpython
- 效率提升
- pip
- pyflakes: Debug
- bottle: micro-framwork
- pytest: Unittest framwork
- hypothesis: Generating test case automatically!
- mypy: Static type checking
- 各类productivity app:https://github.com/hzlzh/Best-App
- 录制terminal: asciinema rec
- python代码格式: $ pip install --upgrade autopep8
- shell操作 $ pip install sh (https://github.com/amoffat/sh)
- 爬虫爬所有的文字:https://github.com/grangier/python-goose
- shell有用操作合集:https://github.com/alexanderepstein/Bash-Snippets
- 实时监控python:livepython [program] [args...]
- 自动搜寻错误信息:https://github.com/danrobinson/tracestack
- github自动化:https://github.com/FriendCode/gittle
- pip
- 造轮子
- kennethreitz
- 快速上手Flask: https://github.com/kennethreitz/saythanks.io
- 500行代码:SQL records:https://github.com/kennethreitz/records
- reddit早期commit: https://github.com/reddit-archive/reddit/commits/bcea327b51b652fc41f41084d8991f9bdb59bd94?after=bcea327b51b652fc41f41084d8991f9bdb59bd94+3005
- 同步blockchain:https://github.com/ccxt/ccxt/tree/master/python
- kennethreitz
- 博客/资源
- 偶像:
- Raymond Hettinger (Python源代码作者之一, Pycon演讲活跃分子)
- 语言方程:https://www.youtube.com/watch?v=HTLu2DFOdTg
- 经典演讲:Beyond Pep8 : https://www.youtube.com/watch?v=wf-BqAjZb8M
- Kenneth Reitz
- Kevon (Dropbox Pystone作者):
- Raymond Hettinger (Python源代码作者之一, Pycon演讲活跃分子)
- 大牛博客合集:https://github.com/FrankFang/best-chinese-front-end-blogs
- request大牛的guide: https://github.com/kennethreitz/python-guide
- 合集继续深度爬:https://github.com/stanzhai/be-a-professional-programmer
- 知乎LIVE:
- 架构个人项目:https://www.zhihu.com/lives/893156713996390400
- 刻意联系:https://www.zhihu.com/lives/883020647280840704
- 哈弗方法论:https://www.zhihu.com/lives/906568256540770304
- 敏捷开发扫盲:https://www.zhihu.com/lives/890599241444122624
- 高效学习:https://www.zhihu.com/lives/918854083484487680
- 思科:https://www.zhihu.com/lives/897123723914649600
- 工程师能力提高:https://www.zhihu.com/lives/916315562223755264
- 3年架构:https://www.zhihu.com/lives/822404350461739008
- 职场:https://www.zhihu.com/lives/770394674849411072
- 扯淡博客:http://www.yinwang.org/
- 增加视野的大牛知乎:https://zhuanlan.zhihu.com/p/25146682
- 偶像:
- Python进阶
- 🍥 Github
- 开源哲学:https://teamhost.gitbooks.io/learn-coding-with-open-source/zh/Start.html#%E4%B8%80%E4%B8%87%E5%B0%8F%E6%97%B6%E7%9A%84%E7%A5%9E%E8%AF%9D
- 目前项目:
- Googler:
- 用Project feature管理repo: https://hackernoon.com/12-cool-things-you-can-do-with-github-f3e0424cf2f0
- marker
- 写个doc: https://github.com/mkdocs/mkdocs
- 好的Readme收集
- 类似代码:https://github.com/bamos/python-scripts/blob/master/generate-readme.py
- CLI代码启发: https://github.com/h4ck3rk3y
- 把我的MD做成类似这样:https://github.com/donnemartin/haxor-news
- 实现fake data:https://github.com/joke2k/faker
- 录制terminal: asciinema rec
- stock
- Googler:
- ideas
- 个人主页:
- 用这个写好的Doc Creator做一个Documentation :https://github.com/pedronauck/docz
- GraphQL扫盲:https://juejin.im/entry/59b623fbf265da065814f8b4
- 写一个类似于这样的tool总和:https://github.com/sindresorhus/quick-look-plugins
- 逆天了。把网站编程API: https://github.com/gaojiuli/toapi
- 一堆有趣的python代码:
- 迅速搭建REST Mongo Wrapper: https://github.com/pyeve/eve
- 用Twitter API做点事: https://github.com/tweepy/tweepy
- 一堆Python的Project Ideas: https://github.com/tuvtran/project-based-learning
- AwesomeAPI大全 https://github.com/SkiaWorks/Awesome_APIs
- 用前端UI搭建我的收费网站:
- 搭建个人的wiki主页:https://github.com/tankywoo/simiki
- Tensorflow学习:https://github.com/vahidk/EffectiveTensorflow
- 扫盲:
- 脑洞打开的各种爬虫: https://github.com/facert/awesome-spider
- 做一个聊天机器人:https://github.com/warmheartli/ChatBotCourse
- 项目思考:https://github.com/karan/Projects
- 做一个类似这样的头像generator: https://github.com/saikatbsk/Vincent-AI-Artist
- Amazon Echo: https://github.com/johnwheeler/flask-ask
- 写一个flask网站:
- 爬虫框架:https://github.com/lorien/grab
- 小爬虫入门:https://github.com/LUCY78765580/Python-web-scraping
- 学点前端:https://github.com/adam-golab/react-developer-roadmap
- 配件升级:
Yu Zhou 🚀 |
MIT © Yu Zhou