上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页
摘要: new和delete表达式可以用来动态创建和释放单个对象,也可以用来动态创建和释放动态数组。 定义变量时,必须指定其数据类型和名字。而动态创建对象时,只需指定其数据类型,而不必为该对象命名。new表达式返回指向新创建对象的指针,我们通过该指针访问对象:1 int i; //named, uni... 阅读全文
posted @ 2015-03-28 09:21 vincently 阅读(1802) 评论(0) 推荐(0) 编辑
摘要: 构造函数是特殊的成员函数,只要创建类类型的对象,都要执行构造函数。构造函数的工作是保证每个对象的数据成员具有合适的初始值。 class Sales_Item {public: //operations on Sales_item objects //default construc... 阅读全文
posted @ 2015-03-26 16:49 vincently 阅读(593) 评论(0) 推荐(0) 编辑
摘要: 题目:输入一个中缀表达式的字符串,出去表达式的结果(只考虑整数)。主要思路为先用栈把中缀表达式转换为后缀表达式,然后计算后缀表达式的值。 1 char * InfixToPostfix(char *s) { 2 if (s == NULL) return NULL; 3 stack ... 阅读全文
posted @ 2015-03-22 22:34 vincently 阅读(459) 评论(0) 推荐(0) 编辑
摘要: 转自:http://blog.csdn.net/chhuach2005/article/details/211681791.题目 编写两个任意位数的大数相乘的程序,给出计算结果。2.题目分析 该题相继被ACM、华为、腾讯等选作笔试、面试题,若无准备要写出这种程序,还是要花一定的时间的。故,觉... 阅读全文
posted @ 2015-03-14 22:38 vincently 阅读(345) 评论(0) 推荐(0) 编辑
摘要: 在计算机科学中,trie,又称前缀树或字典树,是一种有种树,用于保存关联数组,其中的键通常是字符串。与二叉查找树不同,键不是直接保存在节点中,而是由节点在树中的位置决定。一个节点的所有子孙都有相同的前缀,也就是这个节点对应的字符串,而根节点对应空字符串。一般情况下,不是所有的节点都有对应的值,只... 阅读全文
posted @ 2015-03-13 15:52 vincently 阅读(367) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2015-02-26 20:59 vincently 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2015-02-26 20:54 vincently 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 1. 简要介绍 关于二叉树问题,由于其本身固有的递归属性,通常我们可以用递归算法来解决。(《编程之美》,P253) 总结的题目主要以leetcode题目、《剑指offer》以及《编程之美》的题目。2. 测试用例 普通二叉树(完全二叉树,不完全二叉树) 特殊二叉树(所有节点都没有右子节点的二... 阅读全文
posted @ 2015-02-26 19:44 vincently 阅读(827) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解法:自底向上 时间复杂度O(n), 空间复杂度O(logN) 1 clas... 阅读全文
posted @ 2015-02-26 19:16 vincently 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2015-02-25 20:28 vincently 阅读(116) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页