自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 资源 (2)
  • 收藏
  • 关注

原创 crack the code intervie 4.8

You are given a binary tree in which each node contains a value. Design an algorithm to print all paths which sum up to that value. Note that it can be any path in the tree - it does not have to start

2014-03-11 20:08:41 741

原创 crack the code interview 4.7

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 T1.#include using namespace std;stru

2014-03-11 20:08:02 570

原创 crack the code interview 4.6

Design an algorithm and write code to find the first common ancestor of two nodes in a binary tree. Avoid storing additional nodes in a data structure. NOTE: This is not necessarily a binary search tr

2014-03-11 20:06:58 509

原创 crack the code interview 4.5

Write an algorithm to find the ‘next’ node (i.e., in-order successor) of a given node in a binary search tree where each node has a link to its parent.#include using namespace std;struct T

2014-03-11 20:06:20 590

原创 crack the code interview 4.4

Given a binary search tree, design an algorithm which creates a linked list of all the nodes at each depth (i.e., if you have a tree with depth D, you’ll have D linked lists).#include #include

2014-03-11 20:05:39 649

原创 crack the code interview 4.3

Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal height.#include using namespace std;struct TreeNode{    int value;    TreeNode * left;

2014-03-11 20:05:02 363

原创 crack the code interview 4.2

Given a directed graph, design an algorithm to find out whether there is a route between two nodes.#include #include #include using namespace std;enum State {unvisited, visited, visiti

2014-03-11 20:04:10 573

原创 计算机图形学——表面细分

表面细分,举一个粒子,一个立方体,细分很多次以后,表面可有变得平滑。表面细分的一个关键步骤就是加点。如上图的a只有几个点,进过多次细分后,可有增加到很多点,像d一样。如何插点呢,看下图:一个图形,是由很多个三角形组成的,首先,在三角形的边上插点。如果一条边包含在两个三角形中,则插入的点的坐标按照第一个图进行分配,即3/8 * left + 3/8 * right +

2014-03-11 19:59:39 2862

原创 计算机图形学——图像压缩

首先,Huffman算法就可以进行压缩,但是直接用Huffman算法对图片的压缩效率并不高。采用Haar Wavelets,对图片的像素进行处理。首先,将第2i个值和第2i+1个值进行操作,相加除以2,得到的值,存放在i个位置,相减除以2,得到的值放在width/2 + i的像素上。其中,i的取值范围:[0,width/2].如下图所示:      

2014-03-11 19:25:50 1476

原创 计算几何——凸包

1.1 应用场景有多个手机信号发射器,求解一个最小区域,要求所有的发射器都包含在这个最小区域中,并且任意两台发射器之间的交流包含于在这个区域内。将所有的发射器看做为点,任意两个点之间的连线都包含于一个平面S。1.2 问题定义一个平面的子集S是凸的,当且仅当S中的任意两个点之间的连线都包含于S中。点集P的凸包是所有包含P的凸集中的最小的一个。凸包是唯一的。1.3 算法分析将所

2014-03-11 19:01:21 619

电话簿软件的实现(动态查找表算法的应用)

一个完整的电话簿软件应具有以下功能: (1)支持复式电话簿数据的存储,数据条目不少于500条。 每个人名下可保存的信息包括:姓名、手机号码、住宅电话号码、办公电话号码、电子邮件地址、所属群组、备忘录等。 (2)支持电话簿记录的添加、删除、编辑等操作。 (3)将不同类型的人群按照同事、朋友、家人、商务伙伴等分组,支持群组记录的添加、删除、编辑等操作。 (4)支持所有电话簿记录的导入、导出操作,外部数据采用TXT格式。 (5)支持电话簿记录的各种查询操作,具体包括: ① 逐条翻看 能显示所有的电话簿记录,支持分屏查看。 ② 电话号码查找 输入一个电话号码(手机、住宅、办公),能将包含该号码的电话簿记录显示出来。 ③ 人名查找 输入一个人名(全名或者部分名),能将包含该姓名的电话簿记录显示出来。 ④ 群组查找 选择一种群组类型,能将属于该群组的所有电话簿记录显示出来。 (6)要求使用BST或者AVL实现动态索引结构。

2011-02-18

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除