Swap numbers at position first with address at position second
| 84 | |
| 85 | // Swap numbers at position first with address at position second |
| 86 | void swap(std::vector<unsigned>& numbers, size_t first, size_t second) |
| 87 | { |
| 88 | auto temp{ numbers[first] }; |
| 89 | numbers[first] = numbers[second]; |
| 90 | numbers[second] = temp; |
| 91 | } |
| 92 | |
| 93 | // Recursive helper function to sort numbers in ascending sequence |
| 94 | // Numbers to be sorted are from words[start] to words[end] |