构清晰的,无输入错误并且可被编译的代码。这是因为,Google的所有工程师(各个级别)会在同一个代码库中协同工作,让所有人的代码遵循统一的高标准对于提升代码审阅流程的效率至关重要。
You should know at least one programming language really well, and it should preferably be C++, Java, Python or java script. Your need to write both logically and syntactically correct code – COMPILABLE, NOT PSEUDOCODE. So perhaps to practice, try writing code on paper, then put it through a compiler to make sure that your code compiles (and if it doesn’t, then practice some more). Sample topics include: construct / traverse data structures, implement system routines, distill large data sets to single values, transform one data set to another.
你应该至少十分熟悉一种编程语言,如果熟悉C++, Java,Python或者java script更好,你需要在面试中写出逻辑和语法完全正确的代码。请注意,仅仅完成伪代码是不够的,你的代码还需要可以被成功编译执行。请尝试如此练习:你先在纸上写出完整代码,然后将其输入到电脑中试着编译(如果不能编译,你可能需要多加练习)。可以练习的题目包括:构建/遍历数据结构,实现系统流程,从大型数据集合中提取单个值,完成不同数据集合间的转换等。
Data structure and algorithm
数据结构和算法
Basic big-O complexity of space/time analysis is a must. Due to the size of the products you’ll be building, it’s imperative you’re comfortable with big O notation. It is important to understand the basic concepts including List, Array, Trees, Hash tables, Graphs, sorting algorithm, NPC problems, etc. In interviews, you need to demonstrate the capability to apply all these knowledge to solve problems. Sample topics include big-O analysis, sorting and hashing, handling obscenely large amounts of data. Also see topics listed under ‘Coding’.
用“大O表示法”分析算法的时空间复杂度是必须掌握的。由于你将来可能参与构建非常复杂的产品,用“大O表示法”分析执行效率非常重要。你同样需要理解如链表,数组,树,哈希表,图,排序算法,NPC问题等基本概念。并且在面试中,你需要展现出自己有能力应用上述所有知识来解决碰到的问题,包括:利用“大O表示法”进行复杂度分析,排序和哈希算法,超大规模数据的处理以及在“编程”条目下列出的知识点。
●Sorting: Know how to sort. Don’t do bubble-sort. You should know the details of at least onenlog(n) sorting algorithm, preferably two (say, quicksort and merge sort). Merge sort can be highly useful in situations where quicksort is impractical, so take a look at it.
● 排序:你要懂得如何实现数据的排序,除了冒泡排序之外,你需要至少了解一种时间复杂度为nlog(n)的排序算法的细节,了解两种更佳(例如快速排序算法和归并排序算法)。另外,归并排序算法在一些快速排序算法不好用的情形下会非常有效,建议你对此进行深入了解。
●Hashtable: Arguably the single most important data structure known to mankind. You absolutely should know how they work. Be able to implement one using only arrays in your favorite language, in about the space of one interview.
● 哈希表:可以认为,哈希表是所有已有数据结构中最重要的一种。你需要彻底了解它如何工作,并且能够在面试中用擅长的语言用一个数组来完整实现它。
●Trees: Know about trees; basic tree construction, traversal and manipulation algorithms. Familiarize yourself with binary trees, n-ary trees, and trie-trees. Be familiar with at least one type of balanced binary tree, whether it’s a red/black tree, a splay tree or an AVL tree, and know
how it’s implemented. Understand tree traversal algorithms: BFS and DFS, and know the difference between inorder, postorder and preorder.
● 树:你需要了解树的构造,遍历和树的处理算法等基础知识,熟悉二叉树,n叉树以及字典树。你需要至少熟悉红黑树,伸展树和AVL树这三种平衡二叉树的一种,并知道如何实现它们。你需要了解树的两种遍历算法:BFS和DFS,并且知道中序,后序和前序三种遍历算法的区别。
●Graphs: Graphs are really important at Google. There are 3 basic ways to represent a graph in memory (objects and pointers, matrix, and adjacency list); familiarize yourself with each representation and its pros & cons. You should know the basic graph traversal algorithms:
breadth-first search and depth-first search. Know their computational complexity, their tradeoffs, and how to implement them in real code. If you get a chance, try to study up on fancier algorithms, such as Dijkstra.
● 图:图结构在Google中非常重要,你需要熟悉图的三种基本表示方法(对