C语言十大排序算法总结
插入排序
基本思想是每次将一个待排序的记录按其关键字大小插入前面已经排好序的子序列,直到全部记录插入完成。
1.直接插入排序
代码实现
void insertSort(int *arr, int arrSize) { // 依次将arr[1, ..., arrSize - 1]插入到前面已经排序好的位置 for (int i = 1; i < arrSize; i++) { if (arr[i] < arr[i - 1]) { // 若arr[i]小于前驱,需要将其插入前面已经排序好的子序列 int temp = arr[i]; // 从后往前查找待插入位置, 终止条件是,arr[j] <= temp; int j = i - 1; while (arr[j] > temp) { arr[j + 1] = arr[j]; // 后移 j--; ...
Linux-Socket编程
linux c socket
Hello World
Welcome to Hexo! This is your very
first post. Check documentation for
more info. If you get any problems when using Hexo, you can find the
answer in troubleshooting or
you can ask me on GitHub.
Quick Start
Create a new post
$ hexo new "My New Post"
More info: Writing
Run server
$ hexo server
More info: Server
Generate static files
$ hexo generate
More info: Generating
Deploy to remote sites
$ hexo deploy
More info: Deployment