摘要: 题目: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikip 阅读全文
posted @ 2016-03-13 13:40 zhangbaochong 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 无论是在动画还是在一些游戏中,定时器总是必不可少的,游戏的帧数动画的播放等都离不开定时器的控制。这里以dx11龙书中提供的定时器为例,具体看看是怎么实现一个简单但精度高使用方便的定时器的。 这个定时器使用的windows中的高精度计时函数QueryPerformanceCounter和QueryPe 阅读全文
posted @ 2016-03-12 21:11 zhangbaochong 阅读(1663) 评论(0) 推荐(0) 编辑
摘要: 1 static_cast和reinterpret_cast揭秘 收藏 2 本文讨论static_cast<> 和 reinterpret_cast<>。 3 4 reinterpret_cast可以转换任意一个32bit整数,包括所有的指针和整数。可以把任何整数转成指针,也可以把任何指针转成整数, 阅读全文
posted @ 2016-03-10 23:13 zhangbaochong 阅读(935) 评论(0) 推荐(0) 编辑
摘要: 题目: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at a 阅读全文
posted @ 2016-03-10 17:45 zhangbaochong 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 原文地址:http://blog.csdn.net/hackbuteer1/article/details/6583988 先使用先序的方法建立一棵二叉树,然后分别使用递归与非递归的方法实现前序、中序、后序遍历二叉树,并使用了两种方法来进行层次遍历二叉树,一种方法就是使用STL中的queue,另外一 阅读全文
posted @ 2016-03-07 14:02 zhangbaochong 阅读(406) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in 阅读全文
posted @ 2016-03-07 13:58 zhangbaochong 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 原文地址:http://blog.csdn.net/program_think/article/details/7032600/ ★引子 前天,俺在《俺的招聘经验[4]:通过笔试答题能看出啥?》一文,以"求质数"作为例子,介绍了一些考察应聘者的经验。由于本文没有政治敏感内容,顺便就转贴到俺在CSDN 阅读全文
posted @ 2016-03-06 17:54 zhangbaochong 阅读(544) 评论(0) 推荐(0) 编辑
摘要: 题目: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each 阅读全文
posted @ 2016-03-06 17:29 zhangbaochong 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 原文地址http://blog.csdn.net/i_dovelemon/article/details/45827953 齐次坐标 我们都知道,在3D图形学中,所有的变换都可以划分为三种最基础的变换方式,分别为: 旋转变换 缩放变换 平移变换 通过对这三种变换进行组合,就能够实现任意的变换形式。 阅读全文
posted @ 2016-03-05 21:42 zhangbaochong 阅读(3327) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a singly linked list, determine if it is a palindrome. 判断一个单链表是不是回文 思路: 1、遍历整个链表,将链表每个节点的值记录在数组中,再判断数组是不是一个回文数组,时间复杂度为O(n),但空间复杂度也为O(n),不满足空 阅读全文
posted @ 2016-03-04 22:09 zhangbaochong 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 定义:左式堆(Leftist Heaps)又称作最左堆、左倾堆,是计算机语言中较为常用的一个数据结构。左式堆作为堆的一种,保留了堆的一些属性。第1,左式堆仍然以二叉树的形式构建;第2,左式堆的任意结点的值比其子树任意结点值均小(最小堆的特性)。但和一般的二叉堆不同,左式堆不再是一棵完全二叉树(Com 阅读全文
posted @ 2016-03-04 21:13 zhangbaochong 阅读(2374) 评论(1) 推荐(0) 编辑
摘要: 原文链接:http://www.cnblogs.com/qlwy/archive/2011/08/25/2153584.html 公有继承(public)、私有继承(private)、保护继承(protected)是常用的三种继承方式。 1. 公有继承(public) 公有继承的特点是基类的公有成员 阅读全文
posted @ 2016-03-04 18:09 zhangbaochong 阅读(396) 评论(0) 推荐(0) 编辑
摘要: 参考dx11龙书 Chapter2 matrix algebra(矩阵代数) 关于矩阵的一些基本概念定理(例如矩阵加减乘法,逆矩阵,伴随矩阵,转置矩阵等)可以参考维基百科 https://zh.wikipedia.org/wiki/ XNA MATRICES Matrix Types 在xna ma 阅读全文
posted @ 2016-03-03 22:26 zhangbaochong 阅读(2929) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums exc 阅读全文
posted @ 2016-03-03 14:27 zhangbaochong 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 本文参考dx11龙书 Chapter1 vector algebra(向量代数) 要想学好游戏编程,扎实的数学知识是尤为重要的,下面将对dx11龙书中有关向量的数学知识做一下总结。 在数学中,几何向量(也称为欧几里得向量,通常简称向量、矢量),指具有大小(magnitude)和方向(directio 阅读全文
posted @ 2016-03-02 23:13 zhangbaochong 阅读(3803) 评论(0) 推荐(0) 编辑