A*********3 发帖数: 70 | 1 Phone:
SSL, for example a -> b (A refer B)
d -> c (D refer C)
c -> a (C refer A)
find a data structure to save these information and print the following
result: d->c->a->b
Onsite:
1. design public interfaces for cache (like cache for string)
2. design public interfaces for router
3. merge two binary search tree
4. 爬楼梯,每次可以一个step,或者两个step,问有多少种走法?
5. 如何实现一个queue? 怎么分别通过stack,linked list, heap实现?
6. preorder binary search tree.
判断两个binary search tree的pre |
K******g 发帖数: 1870 | 2 请问phone的那题用什么数据结构好
【在 A*********3 的大作中提到】 : Phone: : SSL, for example a -> b (A refer B) : d -> c (D refer C) : c -> a (C refer A) : find a data structure to save these information and print the following : result: d->c->a->b : Onsite: : 1. design public interfaces for cache (like cache for string) : 2. design public interfaces for router : 3. merge two binary search tree
|
A*********r 发帖数: 564 | 3 请问是experienced的吗?
怎么有两道题要design interface, 平时大家在学校编程很少用到interface吧?
我也差不多要准备onsite了,好没有底。。
祝楼主好运。。
【在 A*********3 的大作中提到】 : Phone: : SSL, for example a -> b (A refer B) : d -> c (D refer C) : c -> a (C refer A) : find a data structure to save these information and print the following : result: d->c->a->b : Onsite: : 1. design public interfaces for cache (like cache for string) : 2. design public interfaces for router : 3. merge two binary search tree
|
A*********3 发帖数: 70 | 4 Re KingMing: 我用的linked List 好像没有问题
Re AprilFlower: 这是New Graduates的
public interface就是用户可以使用的一些public method |
f****g 发帖数: 313 | 5 Thanks for sharing :P
Here is my solution for Phone Question:
SSL, for example a -> b (A refer B)
d -> c (D refer C)
c -> a (C refer A)
find a data structure to save these information and print the following
result: d->c->a->b
++++++++++++++++++++
The data structure I pick is Array Hash Table.
Typedef struct NODE{
unsigned char keyVal;
unsigned char *pRefer; // point to the char referred.
} Node;
Node key[26];
Insertion operation: space O(26), tim |
y*********e 发帖数: 518 | |
n*****g 发帖数: 16 | 7 感觉你那个merge 2 BST的程序有点问题。看看下面这个code:
Node* MostLeft(Node *root)
{
if(root->left == NULL)
return root;
else
return MostLeft(root);
}
// Merge two BST in to one BST.
Node* MergeTwoBST(Node* root1, Node* root2)
{
Node *left, *right, *mostLeft;
if(root1 == NULL)
return root2;
if(root2 == NULL)
return root1;
if(root1->value > root2->value)
return MergeTwoBST(root2, root1);
if(root1->value < root2->value)
{
right = root1->r
【在 y*********e 的大作中提到】 : 感谢分享题目。尝试做一下。
|
h**k 发帖数: 3368 | 8 你这个算法的时间负责度是多少?
【在 n*****g 的大作中提到】 : 感觉你那个merge 2 BST的程序有点问题。看看下面这个code: : Node* MostLeft(Node *root) : { : if(root->left == NULL) : return root; : else : return MostLeft(root); : } : // Merge two BST in to one BST. : Node* MergeTwoBST(Node* root1, Node* root2)
|