以下总结是以C++为例子。
面试基本点,数据结构,算法,OO design。把基础结构和思路准备好,万一遇到不会,也可以自己思考融汇贯通,然后就是大量练习leetcode, 面试的时候基本是拿上面的题考,很多思路自己想是想不出来的,比如sliding window解法解maximum subarray这种问题第一次想出来是大拿想了好些年,怎么指望在面试的时候10分钟给KO呢。一句话,刷题,熟能生巧也。
1. Array (vector)
2. LinkedList
3. Tree
4. Graph
5. Stack/Queue
6. Hash map
7. Heap
In C++ STL, there is priority queue which is a max heap.
PS: Adapter/Container in C++. Container is a data type in STL which can hold data. Adapter adapts a container and provides interface. 简单来说就是,container是STL定义的数据结构,而相应的adapter是这些数据结构的operations/interfaces. 比如在C里面普通的数据结构有array, 而stl有vector, stack, queue, 不然你就得自己去实现这些稍微高级点的数据结构。
一个很大路化的minHeap实现方法使用priority_queue, 因为priority_queue支持三种parameters, 你可以定义heap里面元素的类型,heap container的类型,以及是comparator, 虽然我还没太明白为啥这样的comparator就是minHeap了,懂的请留言指导我。。。暂且我就先这么用着了,万一刷题要用呢。
8. bit manipulation
持续更新ing...
No comments:
Post a Comment