摘要: 详细MIT算法导论笔记 (网络链接) 第一讲:课程简介及算法分析(Sheridan) 第二讲:渐近符号、递归及解法 (Sheridan) 第三讲:分治法(1)(Sh... 阅读全文
posted @ 2014-09-02 21:25 平凡的幸福... 阅读(678) 评论(0) 推荐(0) 编辑
摘要: 目录: 1、插入排序算法伪码 2、插入排序c++实现 3、归并排序算法伪码 4、归并排序c++实现 5、总测试程序 此链接为MIT算法导论第一讲详细笔记,感谢Sheridan内容: 1、插入排序算法伪码 T(n) = Θ(n2) Insertion_sort(A[],n) //数... 阅读全文
posted @ 2014-09-01 15:47 平凡的幸福... 阅读(1079) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ... 阅读全文
posted @ 2014-07-11 11:05 平凡的幸福... 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 题目:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or eq... 阅读全文
posted @ 2014-07-09 14:45 平凡的幸福... 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.说明: 1)实现与... 阅读全文
posted @ 2014-07-09 12:34 平凡的幸福... 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.说明: 1)二叉树可... 阅读全文
posted @ 2014-07-09 11:53 平凡的幸福... 阅读(554) 评论(0) 推荐(0) 编辑
摘要: auto定义变量时放在变量前,无需知道具体变量类型,系统可自行推断类型,减少编程工作,特别是在模板使用时,使用更方便。下面简单例子:1 auto a=1;2 auto b='a';3 auto s="abdc";4 auto c;//这样使用时错误的,系统无法自动推断出变量类型5 //下... 阅读全文
posted @ 2014-07-09 11:43 平凡的幸福... 阅读(8385) 评论(0) 推荐(0) 编辑
摘要: 本文转载而来,转载出处:http://www.cppblog.com/doing5552/archive/2010/09/28/127994.html在下列函数声明中,为什么要同时使用*和&符号?以及什么场合使用这种声明方式? void func1( MYCLASS *&pBuildingElem... 阅读全文
posted @ 2014-07-08 17:05 平凡的幸福... 阅读(424) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: P... 阅读全文
posted @ 2014-07-07 16:47 平凡的幸福... 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the corre... 阅读全文
posted @ 2014-07-07 16:21 平凡的幸福... 阅读(301) 评论(0) 推荐(0) 编辑