Skip to content

Commit

Permalink
removed trailing whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
salif-04 committed Oct 8, 2018
1 parent 3011445 commit dc4f609
Showing 1 changed file with 28 additions and 31 deletions.
59 changes: 28 additions & 31 deletions insertion_sort/Java/insertion_sort.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
class InsertionSort
{
public static void sort(int arr[])
{
int n = arr.length;
for (int i=1; i<n; ++i)
{
int key = arr[i];
int j = i-1;
while (j>=0 && arr[j] > key)
{
arr[j+1] = arr[j];
j = j-1;
}
arr[j+1] = key;
}
}
public static void printArray(int arr[])
{
int n = arr.length;
for (int i=0; i<n; ++i)
System.out.print(arr[i] + " ");

System.out.println();
}
public static void main(String args[])
class InsertionSort
{
public static void sort(int arr[])
{
int n = arr.length;
for (int i=1; i<n; ++i)
{
int key = arr[i];
int j = i-1;
while (j>=0 && arr[j] > key)
{
arr[j+1] = arr[j];
j = j-1;
}
arr[j+1] = key;
}
}
public static void printArray(int arr[])
{
int n = arr.length;
for (int i=0; i<n; ++i)
System.out.print(arr[i] + " ");
System.out.println();
}
public static void main(String args[])
{
int[] arr = new int[] {2, 3, 0, 4};

sort(arr);

printArray(arr);
}
}
printArray(arr);
}
}

1 comment on commit dc4f609

@sangamcse

This comment was marked as outdated.

Please sign in to comment.