自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

点滴在心

学习、记录与分享

  • 博客(15)
  • 资源 (7)
  • 收藏
  • 关注

原创 寻找第k小的元素或者第k大的元素 -- O(n)

此题第一思路肯定是, #include #include using namespace std; int partition(int *A,int s,int e);//划分 int select_k(int * A,int n,int k); int select_k_recursive(int * A,int s,int e,int k);//选出第k个大的数 int m

2014-05-29 09:58:10 1359

原创 归并排序

sho #include #include #include "vld.h" using namespace std; void merge_sort_recursive(int *A,int low ,int high); void merge_array(int *A,int low ,int mid ,int high); void merge_sort(int *A,int n)

2014-05-26 21:42:31 469

原创 快速排序--个人思路与书本思路 (复习排序算法)

快速排序的平均时间 #include #include #include using namespace std; int partition(int *A,int low,int high); void qsort(int *A,int n); int q_partition(int *A,int low,int high); void q_sort(int *A,int n)

2014-05-26 17:38:52 523

原创 给定数量的币值,如25分,10分,5分,1分,编写计算n分的有多少种表示方法

这是一个递归枚举问题。

2014-05-21 20:53:03 1507

原创 打印n对括号匹配的所有组合

像er #include #include #include #include using namespace std; void paren(int n,int level,int count_left,int count_right,vector &res,string str); void paren_str(int n); int main() { paren_str(4

2014-05-20 11:14:51 1244

原创 全排列

具体思路是 俩俩交换,

2014-05-19 23:11:03 463

原创 组合 问题

有俩种思路: 1, #include #include #include "vld.h" using namespace std; void combine_str(string str); void combine(string str,int level,string &res,bool *used); bool is_repeat(string str ,int k,bool *us

2014-05-19 21:48:09 503

原创 tcp 与 udp的区别

tcp udp 都是传输层。 tcp 是面向字节流的可靠的传输服务。 u

2014-05-18 10:49:17 567

原创 一个数组arr,长度为N,N小于10^8,里面数字的范围是1~N,是否有重复,并统计出来

#include #include #include #include using namespace std; void count_num(int *array,int n); int main() { int array[10]={4,3,2,3,4,5,2,8,6,2}; count_num(array,10); for (int i = 0 ;i < 10;i++)

2014-05-16 10:52:08 1432

原创 括号匹配问题

用了俩种方式实现,递归,非递归。 此题 #include #include #include using namespace std; bool match(char *str,int &index,int &num); bool is_valid(char *str); bool simple_isvalid(char *str); int main() { char s

2014-05-15 22:18:33 527

原创 丑数

我们把只包含因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但14不是,因为它包含因子7。习惯上我们把1当做是第一个丑数。求按从小到大的顺序的第1500个丑数。 注:1是第一个丑数。 简单的zuofashi

2014-05-13 19:58:40 535

原创 编程之美-先序中序 重建二叉树

#include #include #include "vld.h" using namespace std; struct Node { Node *left; Node *right; char val; Node(char ch) { left = NULL; right = NULL; val = ch; } }; void pre_order(Node

2014-05-03 22:59:36 549

原创 先序中序转后序

#include #include using namespace std; string pre_in_to_post(string str_pre,string str_inorder,string left,string right,string &result); int main() { string str_pre,str_in,str_post; str_pre = "

2014-05-03 20:07:12 743

转载 编程之美3.3——计算字符串的相似度

问题: 1. 计算两个字符串的最长公共子序列(LCS),且公共子序列在字符串中不需要是连续的。 2. 计算两个字符串的距离,完全相同的字符串距离为0,可以通过修改一个字符、增加一个字符或删除一个字符三种方式来使两个字符串相同,但这些方式会使得距离加1。 1.解法: 这两个问题的解法基本相同,都是二维的动态规划,都考虑字符串的后缀(实际上用动态规划更喜欢考虑前缀,但使用前缀时数组最好

2014-05-03 11:11:10 483

原创 堆排序,以及stl中的堆应用

#include #include #include #include using namespace std; void recursive_max_heap_shift_down(int *array,int start,int end); void make_max_heap(int *array,int start,int end); void nonrecursive_make

2014-05-02 16:31:55 724

Visual+C+++课程设计桉例精编 附书代码

Visual+C+++课程设计桉例精编(附书代码)

2013-08-05

Qt实现的玻璃界面效果

Qt实现的玻璃界面效果(反光、半透明。投影

2013-08-05

VC编程小技巧20个

VC编程小技巧20个---最好放到word中看看吧

2010-10-03

VC++基础数据库操作完成学生成绩管理软件

VC++ 基础数据库 操作完成学生成绩管理软件--好东西值得学习

2010-10-03

vc++写的 数字电子钟

vc++写的 数字电子钟 绝对好东西 改造成成自己的时钟

2010-10-03

国人的图书管理系统源码

vc++ 国人的图书管理系统源码---好东东 啊

2010-09-29

排课vc++毕业设计

排课vc++毕业设计,不下不要后悔哦,也是我找了好久的

2010-09-29

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除