摘要: http://www.cnblogs.com/newwy/p/3234536.html 阅读全文
posted @ 2016-09-12 22:05 lp3318 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 时间复杂度O(n*n) 1 // zuichangdizengzixulie.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <vector> 7 #include <iterato 阅读全文
posted @ 2016-09-05 14:26 lp3318 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1 // 16_10jinzhi.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include<iostream> 6 #include<string> 7 #include<math.h> 8 using namespace std; 9 阅读全文
posted @ 2016-09-04 22:10 lp3318 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 1.旋转数组中找最小值 顺序查找时间复杂度为O(n),二分查找时间复杂度为O(logn) 1 // rotateArrMin.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 using namespa 阅读全文
posted @ 2016-08-30 22:40 lp3318 阅读(138) 评论(0) 推荐(0) 编辑
摘要: /******************************** 开始时间:2016-08-28 结束时间: *********************************/ 1.斐波那契数列:0,1,1,2,3,5,8 ······ 题目:获得斐波那契第n项,输出前n项; // Fibona 阅读全文
posted @ 2016-08-29 22:37 lp3318 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 时间复杂度为O(n*n),空间复杂度为O(n)的解法 1 // ShortJobFirst.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <vector> 7 8 using na 阅读全文
posted @ 2016-08-28 22:54 lp3318 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 1.归并排序: 1 // mergeSort.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 using namespace std; 7 8 void m_sort(int arr[],int te 阅读全文
posted @ 2016-08-27 16:43 lp3318 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 要求: 给定一个无序数组arr,求出需要排序的最短子数组长度 1 // getMinLength.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 7 using namespace std; 8 9 阅读全文
posted @ 2016-08-23 20:50 lp3318 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 1.题目: 给定一个无序数组,其中元素 可正可负可0,给定一个k,求arr中所有的子数组累加和为k的最长子数组长度。 1 // maxLength.cpp : 定义控制台应用程序的入口点。 2 //未排序数组中累加和为指定值的最长子数组长度 3 //数组元素可正、可负、可0 4 5 #include 阅读全文
posted @ 2016-08-18 22:06 lp3318 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 可整合子数组:按由小到大排完序之后,后面的数比前一个数大1,如:[2,4,3,6,5]就是可整合数组。 1 // getLiL.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <ha 阅读全文
posted @ 2016-08-17 23:36 lp3318 阅读(209) 评论(0) 推荐(0) 编辑