
Implement partition, which rearranges the range a[lo..hi] around the pivot a[hi] following the Lomuto scheme and returns the index the pivot ends up on.
int a[] = {9, 4, 7, 1, 8, 5, 6}; partition(a, 0, 6);p=3 a=[4, 1, 5, 6, 8, 7, 9]int a[] = {5, 2, 5, 9, 5}; partition(a, 0, 4);p=3 a=[5, 2, 5, 5, 9]int a[] = {100, 5, 3, 9, 4, 200}; partition(a, 1, 4);p=2 a=[100, 3, 4, 9, 5, 200]int a[] = {42}; partition(a, 0, 0);p=0 a=[42]partition.c<stddef.h>defines size_t
Run the tests to grade your code
Implement partition, which rearranges the range a[lo..hi] around the pivot a[hi] following the Lomuto scheme and returns the index the pivot ends up on.
int a[] = {9, 4, 7, 1, 8, 5, 6}; partition(a, 0, 6);p=3 a=[4, 1, 5, 6, 8, 7, 9]int a[] = {5, 2, 5, 9, 5}; partition(a, 0, 4);p=3 a=[5, 2, 5, 5, 9]int a[] = {100, 5, 3, 9, 4, 200}; partition(a, 1, 4);p=2 a=[100, 3, 4, 9, 5, 200]int a[] = {42}; partition(a, 0, 0);p=0 a=[42]partition.c<stddef.h>defines size_t
Run the tests to grade your code
Memory will appear here