Write a C program to implement Quick Sort to sort an array of integers in ascending order.
First line: N. Second line: N space-separated integers.
Print the sorted array separated by a space.
1 <= N <= 1000
5 10 7 8 9 1
1 7 8 9 10
Partition-based sorting algorithm dividing around a pivot.
#include <stdio.h>
void swap(int* a, int* b) {
int t = *a;
*a = *b;
*b = t;
}
int partition (int arr[], int low, int high) {
int pivot = arr[high];
int i = (low - 1);
for (int j = low; j <= high - 1; j++) {
if (arr[j] < pivot) {
i++;
swap(&arr[i], &arr[j]);
}
}
swap(&arr[i + 1], &arr[high]);
return (i + 1);
}
void quickSort(int arr[], int low, int high) {
if (low < high) {
int pi = partition(arr, low, high);
quickSort(arr, low, pi - 1);
quickSort(arr, pi + 1, high);
}
}
int main() {
int n;
if (scanf("%d", &n) == 1) {
int arr[n];
for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
quickSort(arr, 0, n - 1);
for (int i = 0; i < n; i++) {
printf("%d", arr[i]);
if (i < n - 1) printf(" ");
}
printf("n");
}
return 0;
}Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used