• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
中二病程序猿
博客园 首页 新随笔 联系 订阅 订阅 管理
1 2 3 下一页

2014年7月13日

CTCI 4.8
摘要: You have two very large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of ... 阅读全文
posted @ 2014-07-13 10:10 中二病程序猿 阅读(139) 评论(0) 推荐(0)
 
CTCI 4.7
摘要: Design an algorithm and write code to find the first common ancestory of two nodes in a binary tree. Avoid storing additional nodes in data structure.... 阅读全文
posted @ 2014-07-13 09:49 中二病程序猿 阅读(195) 评论(0) 推荐(0)
 
 

2014年7月12日

CTCI 4.5
摘要: Implement a function to check if a binary tree is a binary search tree./* The inorder travel of a BST is strictly increasing. We track the pre node of... 阅读全文
posted @ 2014-07-12 23:14 中二病程序猿 阅读(144) 评论(0) 推荐(0)
 
 

2014年7月11日

CTCI 4.4
摘要: Given a binary tree, design an algorithm which creates a linked list of all the nodes at each depth (e.g., if you have a tree with depth D,you'll have... 阅读全文
posted @ 2014-07-11 20:39 中二病程序猿 阅读(194) 评论(0) 推荐(0)
 
CTCI 4.3
摘要: Given a sorted (increasing order) array with unique integer elements, write an algorithm to create a binary search tree with minimal height.There is a... 阅读全文
posted @ 2014-07-11 19:04 中二病程序猿 阅读(140) 评论(0) 推荐(0)
 
CTCI 4.1
摘要: Implement a function to check if a binary tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that the h... 阅读全文
posted @ 2014-07-11 18:10 中二病程序猿 阅读(142) 评论(0) 推荐(0)
 
 

2014年7月10日

CTCI 3.6
摘要: Write a program to sort a stack in ascending order (with biggest items on top). You may use at most one additional stack to hold items, but you may no... 阅读全文
posted @ 2014-07-10 22:14 中二病程序猿 阅读(205) 评论(0) 推荐(0)
 
CTCI 3.5
摘要: Implement a MyQueue class which implements a queue using two stacks./*Use two stacks, when enqueue, first pop all the elements in stack2 on stack1, th... 阅读全文
posted @ 2014-07-10 21:05 中二病程序猿 阅读(129) 评论(0) 推荐(0)
 
CTCI 3.3
摘要: Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ... 阅读全文
posted @ 2014-07-10 10:33 中二病程序猿 阅读(394) 评论(0) 推荐(0)
 
 

2014年7月9日

CTCI 3.2
摘要: How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min should a... 阅读全文
posted @ 2014-07-09 23:51 中二病程序猿 阅读(197) 评论(0) 推荐(0)
 
 
1 2 3 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3