formatting source-code for d7af6fdc8c

This commit is contained in:
github-actions
2020-05-29 23:26:30 +00:00
parent edb3d51ec2
commit 7ad1f171c1
176 changed files with 5342 additions and 4288 deletions

View File

@@ -10,14 +10,17 @@
#include <iostream>
void SlowSort(int a[], int i, int j) {
if (i >= j) return;
void SlowSort(int a[], int i, int j)
{
if (i >= j)
return;
int m = i + (j - i) / 2; // midpoint, implemented this way to avoid
// overflow
int temp;
SlowSort(a, i, m);
SlowSort(a, m + 1, j);
if (a[j] < a[m]) {
if (a[j] < a[m])
{
temp = a[j]; // swapping a[j] & a[m]
a[j] = a[m];
a[m] = temp;
@@ -27,7 +30,8 @@ void SlowSort(int a[], int i, int j) {
// Sample Main function
int main() {
int main()
{
int size;
std::cout << "\nEnter the number of elements : ";
@@ -37,7 +41,8 @@ int main() {
std::cout << "\nEnter the unsorted elements : ";
for (int i = 0; i < size; ++i) {
for (int i = 0; i < size; ++i)
{
std::cout << "\n";
std::cin >> arr[i];
}
@@ -46,7 +51,8 @@ int main() {
std::cout << "Sorted array\n";
for (int i = 0; i < size; ++i) {
for (int i = 0; i < size; ++i)
{
std::cout << arr[i] << " ";
}