字符串反转
给定字符串 “hello, world”, 实现将其反转
1 | void char_reverse(char* cha) |
*单链表反转
1 | // 定义一个链表 |
有序数组合并
1 | void mergeList(int a[], int aLen, int b[], int bLen, int result[]) |
1 | int a[5] = {1, 4, 6, 7, 9} |
Hash算法
在一个字符串中找到第一个只出现一次的字符.
如 “abaccde”, // b
1 | 字符(char)是一个长度为8的数据类型, 因此总共有可能256种可能. |
1 | char findFirstChar(char* cha) |
*查找两个子视图的共同父视图
1 | - (NSArray <UIView *> *)findCommonSuperView:(UIView *)viewOne other:(UIView *)viewOther |
求无序数组的中位数
- 排序算法 + 中位数 // 冒泡/快速排序, 分元素个数奇偶取得中位数
- 利用快排 (分治思想)
1 | 任意挑一个元素, 以该元素为支点, 划分集合为两部分 |
1 | //求一个无序数组的中位数 |
1 | // 无序数组查找中位数 |
- 本文作者: 醉疏狂
- 本文链接: https://hubin97.github.io/2020/05/20/算法/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!