摘要: 题目: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1->2 阅读全文
posted @ 2016-02-29 22:08 zhangbaochong 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 二叉堆是一种特殊的堆,二叉堆是完全二元树(二叉树)或者是近似完全二元树(二叉树)。 二叉堆有两种:最大堆和最小堆。 最大堆:父结点的键值总是大于或等于任何一个子结点的键值; 最小堆:父结点的键值总是小于或等于任何一个子节点的键值。 二叉堆一般都通过"数组"来实现。数组实现的二叉堆,父节点和子节点的位 阅读全文
posted @ 2016-02-13 21:14 zhangbaochong 阅读(2795) 评论(0) 推荐(1) 编辑
摘要: 题目: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a l 阅读全文
posted @ 2016-02-13 19:06 zhangbaochong 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After 阅读全文
posted @ 2016-02-10 19:02 zhangbaochong 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 题目: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 阅读全文
posted @ 2016-02-10 18:00 zhangbaochong 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 题目: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → 阅读全文
posted @ 2016-02-10 17:37 zhangbaochong 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 题目: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1 阅读全文
posted @ 2016-02-03 16:53 zhangbaochong 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 代 阅读全文
posted @ 2016-02-03 16:36 zhangbaochong 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorithm t 阅读全文
posted @ 2016-02-03 16:13 zhangbaochong 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 根据前面两个笔记的内容,我们来封装一个简单的基类,方便以后的使用。 代码和前面类似,没有什么新的内容,直接看代码吧(由于代码上次都注释了,这次代码就没怎么写注释o(╯□╰)o) Dx11DemoBase.h Dx11DemoBase.h #pragma once #include <d3d11.h> 阅读全文
posted @ 2016-02-02 21:27 zhangbaochong 阅读(4145) 评论(0) 推荐(2) 编辑
摘要: 在先前的解决方案中新建一个新的Win32项目FirstD3D11Demo。在写代码之前,我们必须先添加dx11所需要的库。为了链接dx库,右键项目选择属性->vc++目录,在包含目录中添加你所安装的SDK根目录\Include,在库目录中添加 根目录\lib\x86(或x64),在链接器->输入的附 阅读全文
posted @ 2016-01-31 22:18 zhangbaochong 阅读(16811) 评论(1) 推荐(4) 编辑
摘要: 平衡二叉树(Balanced Binary Tree)又被称为AVL树(有别于AVL算法),且具有以下性质:它是一 棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树。这个方案很好的解决了二叉查找树退化成链表的问题,把插入,查找,删除的时间复杂度最好情况和最坏情况都 阅读全文
posted @ 2016-01-28 13:51 zhangbaochong 阅读(186892) 评论(11) 推荐(18) 编辑
摘要: #pragma once 这是一个比较常用的指令,只要在头文件的最开始加入这条指令就能够保证头文件被编译一次 #pragma once用来防止某个头文件被多次include,#ifndef,#define,#endif用来防止某个宏被多次定义。 #pragma once是编译相关,就是说这个编译系统 阅读全文
posted @ 2016-01-27 22:39 zhangbaochong 阅读(5833) 评论(0) 推荐(1) 编辑
摘要: 原帖地址:http://blog.csdn.net/popy007/article/details/4091967上一篇文章中我们讨论了透视投影变换的原理,分析了OpenGL所使用的透视投影矩阵的生成方法。正如我们所说,不同的图形API因为左右手坐标系、行向量列向量矩阵以及变换范围等等的不同导致了矩... 阅读全文
posted @ 2016-01-26 16:03 zhangbaochong 阅读(1875) 评论(0) 推荐(0) 编辑
摘要: 题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complet... 阅读全文
posted @ 2016-01-26 14:04 zhangbaochong 阅读(256) 评论(0) 推荐(0) 编辑