上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: 主要是单链表的一些常见操作:像创建链表,删除结点,插入结点,链表逆序,按大小排序等 1 #include 2 using namespace std; 3 4 struct Node 5 { 6 int val; 7 Node *next; 8 Node(... 阅读全文
posted @ 2016-01-20 21:29 zhangbaochong 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 双向链表结构:定义一个如下结构体struct Node{ Object data; Node *next; Node *prev;};下面为list的具体实现:#include using namespace std;template class List{private: ... 阅读全文
posted @ 2016-01-20 19:41 zhangbaochong 阅读(728) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is... 阅读全文
posted @ 2016-01-19 21:18 zhangbaochong 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 实现一个简单的vector Vector基于数组实现,可以复制并且其占用的内存可以自动回收(通过析构函数),可以调整Vector的大小,以及容量(容量的改变是通过为基本数组分配一个新的内存块,然后复制旧的内存块到新块中,再释放旧块的内存)。在进行插入和删除操作时,需要位置标记,这里使用通用的迭代器... 阅读全文
posted @ 2016-01-19 19:59 zhangbaochong 阅读(914) 评论(0) 推荐(0) 编辑
摘要: 声明:本系列教程代码有部分来自dx11龙书及dx11游戏编程入门两本书,后面不再说明 首先,在vs2013中创建一个空的解决方案Dx11Demo,以后的工程都会放在这个解决方案下面。然后创建一个win32项目,勾选空项目,确定 在源文件中添加一个c++ Source File main.cpp 创建 阅读全文
posted @ 2016-01-19 14:35 zhangbaochong 阅读(12851) 评论(3) 推荐(1) 编辑
摘要: 题目:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the ... 阅读全文
posted @ 2016-01-18 22:07 zhangbaochong 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum... 阅读全文
posted @ 2015-12-24 20:04 zhangbaochong 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 问题:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2... 阅读全文
posted @ 2015-12-22 22:30 zhangbaochong 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], the largest formed ... 阅读全文
posted @ 2015-12-21 23:23 zhangbaochong 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't ... 阅读全文
posted @ 2015-12-20 20:04 zhangbaochong 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].S... 阅读全文
posted @ 2015-12-20 19:22 zhangbaochong 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the ... 阅读全文
posted @ 2015-12-20 14:13 zhangbaochong 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 题目:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive inte... 阅读全文
posted @ 2015-12-19 20:52 zhangbaochong 阅读(522) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, giv... 阅读全文
posted @ 2015-12-19 20:34 zhangbaochong 阅读(663) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complex... 阅读全文
posted @ 2015-12-18 22:00 zhangbaochong 阅读(224) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页