Download benchmarks/Algorithms/insertion_sort/solution.c from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 350 Bytes
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/insertion_sort/solution.c
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/benchmarks/Algorithms/insertion_sort/solution.c
-
curl -L -o solution.c https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/insertion_sort/solution.c
350 Bytes
| int* sortArray(int* nums, int numsSize, int* returnSize) | |
| { | |
| *returnSize = numsSize; | |
| for (int i = 1; i < numsSize; ++i) { | |
| int key = nums[i]; | |
| int j = i - 1; | |
| while (j >= 0 && nums[j] > key) { | |
| nums[j + 1] = nums[j]; | |
| j--; | |
| } | |
| nums[j + 1] = key; | |
| } | |
| return nums; | |
| } | |