程序员如何快速准备面试中的算法


http://blog.csdn.net/v_july_v/article/details/19131887

尽管在微博上简单梳理过,如下图所示:
   
    但因字数限制,许多问题无法一次性说清楚,故特撰此文着重阐述下:程序员如何快速准备面试中的算法,继而推荐一些相关的书籍或资料。顺便也供节后跳槽、3月春季招聘小高潮、及6月毕业找工作的朋友参考。

备战面试中算法的五个步骤

    对于立志进一线互联网公司,同时不满足于一辈子干纯业务应用开发,希望在后端做点事情的同学来说,备战面试中的算法,分为五个步骤,如下:
    1、掌握一门编程语言
    首先你得确保你已掌握好一门编程语言:
  • C的话,推荐Dennis M. Ritchie & Brian W. Kernighan合著的《C程序设计语言》、《C和指针》,和《征服C 指针》;
  • C++ 则推荐《C++ Primer》,《深度探索C++对象模型》,《Effective C++》 。
    掌握一门语言并不容易,不是翻完一两本书即可了事,语言的细枝末节需要在平日不断的编程练习中加以熟练。
    2、过一遍微软面试100题系列
    我从2010年起开始整理微软面试100题系列,见过的题目不可谓不多,但不管题目怎般变化,依然是那些常见的题型和考察点,当然,不考察任何知识点,纯粹考察编程能力的题目也屡见不鲜。故不管千变万化,始终不离两点:①看你基本知识点的掌握情况;②编程基本功。
    而当你看了一遍微软面试100题之后(不要求做完,且这个系列的有些答案存在不少问题,建议以我的新书《编程之法》为准),你自会意识到:数据结构和算法在笔试面试中的重要性。
    3、苦补数据结构基础
    如果学数据结构,可以看我们在大学里学的任一本数据结构教材都行,包括链表、数组、字符串、矩阵、树、图等等,如果你觉得实在不够上档次,那么可以再看看《STL源码剖析》。
    4、看算法导论
    《算法导论》上的前大部分的章节都在阐述一些经典常用的数据结构和典型算法(如二分查找快速排序Hash表),以及一些高级数据结构(诸如红黑树B树),如果你已经学完了一本数据结构教材,那么建议你着重看贪心、动态规划、图论等内容,这3个议题每一个议题都大有题目可出。同时,熟悉常用算法的时间复杂度
    如果算法导论看不懂,你可以参看本博客。
    5、刷leetcode或cc150或编程艺术系列
  • 如主要在国外找工作,推荐两个编程面试网站:一个是国外一网站leetcode,它上面有个OJ对于找工作的同学来说非常值得一刷https://oj.leetcode.com/;另外一个是http://www.careercup.com/,而后这个网站的创始人写了本书,叫《careercup cracking coding interview》,最终这本英文书被图灵教育翻译出版为《程序员面试金典》。
  • 若如果是国内找工作,则郑重推荐编程之法github,尤其是在博客版本基础上精简优化的我的新书《编程之法。除此之外,还可看看《编程之美》,与《剑指offer》。
    而不论是准备国内还是国外的海量数据处理面试题,此文必看:教你如何迅速秒杀掉:99%的海量数据处理面试题。收录于新书《编程之法》第六章。
    此外,多看看优秀的开源代码,如nginx或redis,多做几个项目加以实践之,尽早实习(在一线互联网公司实习3个月可能胜过你自个黑灯瞎火摸爬滚打一年)。
    当然,如果你已经具备了上文所说的语言 & 数据结构 & 算法基础,可以直接跳到本第五步骤,开始刷leetcode或cc150或编程艺术系列。

后记

    学习最忌心浮气躁,急功近利,即便练习了算法,也不一定代表能万无一失通过笔试面试关,因为总体说来,在一般的笔试面试中,70%基础+ 30%coding能力(含算法),故如果做到了上文中的5个步骤,还远远不够,最后,我推荐一份非算法的书单,以此为大家查漏补缺(不必全部看完,欢迎大家补充):
  1. 《深入理解计算机系统》
  2. W.Richard Stevens著的《TCP/IP详解三卷》,《UNIX网络编程二卷》,《UNIX环境高级编程:第2版》,详见此豆瓣页面
  3. 你如果要面机器学习一类的岗位,建议看看相关的算法(支持向量机通俗导论(理解SVM的三层境界),收录于新书《编程之法》第7.1节),及老老实实补补数学基础,包括微积分、线性代数、概率论与数理统计(除了教材,推荐一本《数理统计学简史》)、矩阵论(推荐《矩阵分析与应用》)等..
    综上:上述全部过程短则半年,长则三年。
    最后要强调的是:切忌急功近利,越想快速越要循序渐进,踏实前进,若实在觉得算法 & 编程太难,转产品、运营、测试、运维、前端、设计都是不错的选择,因为虽然编程有趣,但不一定人人适合编程。

Labels

LeetCode (1432) GeeksforGeeks (1122) LeetCode - Review (1067) Review (882) Algorithm (668) to-do (609) Classic Algorithm (270) Google Interview (237) Classic Interview (222) Dynamic Programming (220) DP (186) Bit Algorithms (145) POJ (141) Math (137) Tree (132) LeetCode - Phone (129) EPI (122) Cracking Coding Interview (119) DFS (115) Difficult Algorithm (115) Lintcode (115) Different Solutions (110) Smart Algorithm (104) Binary Search (96) BFS (91) HackerRank (90) Binary Tree (86) Hard (79) Two Pointers (78) Stack (76) Company-Facebook (75) BST (72) Graph Algorithm (72) Time Complexity (69) Greedy Algorithm (68) Interval (63) Company - Google (62) Geometry Algorithm (61) Interview Corner (61) LeetCode - Extended (61) Union-Find (60) Trie (58) Advanced Data Structure (56) List (56) Priority Queue (53) Codility (52) ComProGuide (50) LeetCode Hard (50) Matrix (50) Bisection (48) Segment Tree (48) Sliding Window (48) USACO (46) Space Optimization (45) Company-Airbnb (41) Greedy (41) Mathematical Algorithm (41) Tree - Post-Order (41) ACM-ICPC (40) Algorithm Interview (40) Data Structure Design (40) Graph (40) Backtracking (39) Data Structure (39) Jobdu (39) Random (39) Codeforces (38) Knapsack (38) LeetCode - DP (38) Recursive Algorithm (38) String Algorithm (38) TopCoder (38) Sort (37) Introduction to Algorithms (36) Pre-Sort (36) Beauty of Programming (35) Must Known (34) Binary Search Tree (33) Follow Up (33) prismoskills (33) Palindrome (32) Permutation (31) Array (30) Google Code Jam (30) HDU (30) Array O(N) (29) Logic Thinking (29) Monotonic Stack (29) Puzzles (29) Code - Detail (27) Company-Zenefits (27) Microsoft 100 - July (27) Queue (27) Binary Indexed Trees (26) TreeMap (26) to-do-must (26) 1point3acres (25) GeeksQuiz (25) Merge Sort (25) Reverse Thinking (25) hihocoder (25) Company - LinkedIn (24) Hash (24) High Frequency (24) Summary (24) Divide and Conquer (23) Proof (23) Game Theory (22) Topological Sort (22) Lintcode - Review (21) Tree - Modification (21) Algorithm Game (20) CareerCup (20) Company - Twitter (20) DFS + Review (20) DP - Relation (20) Brain Teaser (19) DP - Tree (19) Left and Right Array (19) O(N) (19) Sweep Line (19) UVA (19) DP - Bit Masking (18) LeetCode - Thinking (18) KMP (17) LeetCode - TODO (17) Probabilities (17) Simulation (17) String Search (17) Codercareer (16) Company-Uber (16) Iterator (16) Number (16) O(1) Space (16) Shortest Path (16) itint5 (16) DFS+Cache (15) Dijkstra (15) Euclidean GCD (15) Heap (15) LeetCode - Hard (15) Majority (15) Number Theory (15) Rolling Hash (15) Tree Traversal (15) Brute Force (14) Bucket Sort (14) DP - Knapsack (14) DP - Probability (14) Difficult (14) Fast Power Algorithm (14) Pattern (14) Prefix Sum (14) TreeSet (14) Algorithm Videos (13) Amazon Interview (13) Basic Algorithm (13) Codechef (13) Combination (13) Computational Geometry (13) DP - Digit (13) LCA (13) LeetCode - DFS (13) Linked List (13) Long Increasing Sequence(LIS) (13) Math-Divisible (13) Reservoir Sampling (13) mitbbs (13) Algorithm - How To (12) Company - Microsoft (12) DP - Interval (12) DP - Multiple Relation (12) DP - Relation Optimization (12) LeetCode - Classic (12) Level Order Traversal (12) Prime (12) Pruning (12) Reconstruct Tree (12) Thinking (12) X Sum (12) AOJ (11) Bit Mask (11) Company-Snapchat (11) DP - Space Optimization (11) Dequeue (11) Graph DFS (11) MinMax (11) Miscs (11) Princeton (11) Quick Sort (11) Stack - Tree (11) 尺取法 (11) 挑战程序设计竞赛 (11) Coin Change (10) DFS+Backtracking (10) Facebook Hacker Cup (10) Fast Slow Pointers (10) HackerRank Easy (10) Interval Tree (10) Limited Range (10) Matrix - Traverse (10) Monotone Queue (10) SPOJ (10) Starting Point (10) States (10) Stock (10) Theory (10) Tutorialhorizon (10) Kadane - Extended (9) Mathblog (9) Max-Min Flow (9) Maze (9) Median (9) O(32N) (9) Quick Select (9) Stack Overflow (9) System Design (9) Tree - Conversion (9) Use XOR (9) Book Notes (8) Company-Amazon (8) DFS+BFS (8) DP - States (8) Expression (8) Longest Common Subsequence(LCS) (8) One Pass (8) Quadtrees (8) Traversal Once (8) Trie - Suffix (8) 穷竭搜索 (8) Algorithm Problem List (7) All Sub (7) Catalan Number (7) Cycle (7) DP - Cases (7) Facebook Interview (7) Fibonacci Numbers (7) Flood fill (7) Game Nim (7) Graph BFS (7) HackerRank Difficult (7) Hackerearth (7) Inversion (7) Kadane’s Algorithm (7) Manacher (7) Morris Traversal (7) Multiple Data Structures (7) Normalized Key (7) O(XN) (7) Radix Sort (7) Recursion (7) Sampling (7) Suffix Array (7) Tech-Queries (7) Tree - Serialization (7) Tree DP (7) Trie - Bit (7) 蓝桥杯 (7) Algorithm - Brain Teaser (6) BFS - Priority Queue (6) BFS - Unusual (6) Classic Data Structure Impl (6) DP - 2D (6) DP - Monotone Queue (6) DP - Unusual (6) DP-Space Optimization (6) Dutch Flag (6) How To (6) Interviewstreet (6) Knapsack - MultiplePack (6) Local MinMax (6) MST (6) Minimum Spanning Tree (6) Number - Reach (6) Parentheses (6) Pre-Sum (6) Probability (6) Programming Pearls (6) Rabin-Karp (6) Reverse (6) Scan from right (6) Schedule (6) Stream (6) Subset Sum (6) TSP (6) Xpost (6) n00tc0d3r (6) reddit (6) AI (5) Abbreviation (5) Anagram (5) Art Of Programming-July (5) Assumption (5) Bellman Ford (5) Big Data (5) Code - Solid (5) Code Kata (5) Codility-lessons (5) Coding (5) Company - WMware (5) Convex Hull (5) Crazyforcode (5) DFS - Multiple (5) DFS+DP (5) DP - Multi-Dimension (5) DP-Multiple Relation (5) Eulerian Cycle (5) Graph - Unusual (5) Graph Cycle (5) Hash Strategy (5) Immutability (5) Java (5) LogN (5) Manhattan Distance (5) Matrix Chain Multiplication (5) N Queens (5) Pre-Sort: Index (5) Quick Partition (5) Quora (5) Randomized Algorithms (5) Resources (5) Robot (5) SPFA(Shortest Path Faster Algorithm) (5) Shuffle (5) Sieve of Eratosthenes (5) Strongly Connected Components (5) Subarray Sum (5) Sudoku (5) Suffix Tree (5) Swap (5) Threaded (5) Tree - Creation (5) Warshall Floyd (5) Word Search (5) jiuzhang (5)

Popular Posts