### Cracking the Coding Interview

7 已关注
18篇博文
• #### Chapter 4 | Trees and Graphs--有序数组构建最小高度的二叉树

4.3  Given a sorted (increasing order) array, write an algorithm to createa binary tree with minimal...

2014-08-05 20:34
1056
• #### Chapter 4 | Trees and Graphs--判断有向图两节点之间是否存在路径

4.2  Given a directed graph, design an algorithm to find out whether thereis a route between two nod...

2014-07-24 15:10
2292
• #### Chapter 4 | Trees and Graphs--检查一棵树是否平衡以及判断一棵树是否为平衡二叉树

4.1  Implement a function to check if a tree is balanced. For the purposes of this question, a balan...

2014-04-08 17:03
1149
• #### Chapter 3 | Stacks and Queues--两个栈实现队列

3.5  Implement a MyQueue class which implements a queue using two stacks. 译文： 利用两个栈实现一个队列 MyQueue。 ...

2014-03-21 16:36
898
• #### Chapter 3 | Stacks and Queues--栈解决汉诺塔问题

3.4  In the classic problem of the Towers of Hanoi, you have 3 rods and Ndisks of different sizes wh...

2014-03-19 20:29
1779
• #### Chapter 3 | Stacks and Queues--实现数据结构模拟一个栈由几个子栈组成，并可以在指定子栈上进行出栈操作

3.3  Imagine a (literal) stack of plates. If the stack gets too high,it might topple. Therefore, in ...

2014-03-17 21:54
1106
• #### Chapter 3 | Stacks and Queues--实现一个函数返回栈中的最小值，时间复杂度为O(1)

3.2  How would you design a stack which, in addition to push and pop,also has a function min which r...

2014-02-17 21:34
1098
• #### Chapter 3 | Stacks and Queues--一个数组实现三个栈（续）

针对上篇博文中方法二的问题，这里我们提供一个方法来解决所出现的空间浪费的问题 上篇博文见：一个数组实现三个栈(1) 方法二加强版：下面就针对这个问题对程序进行进一步的修改。1、每次 pop 出栈之后...

2013-12-31 12:01
1487
• #### Chapter 3 | Stacks and Queues--一个数组实现三个栈

3.1 Describe how you could use a single array to implement three stacks.

2013-12-30 21:56
1681
• #### Chapter 2 | Linked Lists--查找循环链表中的环的开始结点

2.5  Given a circular linked list, implement an algorithm which returns node at the beginning of the...

2013-12-21 10:00
2479
• #### Chapter 2 | Linked Lists--实现两个单链表数据的和

2.4     You have two numbers represented by a linked list, where each node contains a single digit. ...

2013-12-19 10:20
931
• #### Chapter 2 | Linked Lists--返回单链表倒数第n个元素及删除中间的某个节点

2.2    Implement an algorithm to find the nth to last element of a singly linked list. 译文：实现一个算法返回单链...

2013-12-05 13:23
2064
• #### Chapter 2 | Linked Lists--移除未排序链表中的重复项

2.1    Write code to remove duplicates from an unsorted linked list.          FOLLOW UP          How...

2013-12-03 20:05
1438
• #### Chapter 1 | Arrays and Strings--旋转字符串的判断

1.7   Write an algorithm such that if an element in an M*N matrix is 0,its entire row and column is ...

2013-11-30 16:58
1650
• #### Chapter 1 | Arrays and Strings--旋转N*N矩阵的图像和处理M*N矩阵，若某位置为0则所在行和列均置0

1.6    Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write ...

2013-11-30 11:13
2007
• #### Chapter 1 | Arrays and Strings--判断变位词和字符串空格替换为‘ ’

1.4    Write a method to decide if two strings are anagrams or not. 译文：写一个函数判断是否两个字符串为变位词。变位词就是两个字符...

2013-11-27 18:44
1427
• #### Chapter 1 | Arrays and Strings--字符串的翻转与去重

1.2    Write code to reverse a C-Style String. (C-String means that “abcd” is represented as five ch...

2013-11-26 18:39
1578
• #### Chapter 1 | Arrays and Strings -- 判断字符串中字符唯一

1.1    Implement an algorithm to determine if a string has all unique characters.What if you can not...

2013-11-25 16:51
1927