- 博客(8)
- 收藏
- 关注
转载 插入排序
由于此博文并不难,所以并不需要搬出C++特性的这些大山,所以就使用简单的C++代码描述了。^_^直接插入排序是一种简单的插入排序法,所以适用于少量数据的排序,直接插入排序是比较稳定的一种排序算法。其基本思想是:把待排序的纪录按其关键码值的大小逐个插入到一个已经排好序的有序序列中,直到所有的纪录插入完为止,得到一个新的有序序列。插入排序:时间复杂度O(n^2)直接插入排序是属于In-place so...
2018-02-24 15:14:47
142
原创 LeetCode: Longest Substring Without Repeating Characters (3)
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with the l...
2018-02-09 16:54:50
120
原创 LeetCode: 4 Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The solution set mu
2017-06-21 17:23:23
185
原创 LeetCode: 3 Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
2017-06-05 18:34:13
335
原创 LeetCode: 2 Sum (Input array is sorted)
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
2017-06-05 18:26:27
189
原创 LeetCode: 2 Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
2017-06-05 18:12:03
179
原创 一. C&C++ 基础一
1.指针相关Sample: a. int *a[10] //指针数组 b. int (*a)[10] //数组指针(数组里面存放的是指针) c. int (*a)(int) //指针函数 d. int (*a[10])(int) //函数指针数组(数组里存放的是函数指针) e. int *a,int **a //指向a 的
2017-04-26 16:57:59
211
原创 一. C&C++ 基础二
C 语言和C++ 的区别 C语言是面向结构的,而c++ 是面向对象的 。 结构体,联合体,以及类的区别 联合体: union A{ int i; char b; }; 使用不同类型的变量共享一段内存 。 结构体: 把不同的的数据类型组成新的结构 。 struct B{ int a ; //4 字节 32位系统 char b;
2017-04-26 15:25:35
187
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人