Skip to content

Commit

Permalink
Update Bubble Sort algorithm to extends from SortingAlgorithm instead…
Browse files Browse the repository at this point in the history
… of implement it
  • Loading branch information
pedrovgs committed Feb 1, 2015
1 parent b5291a0 commit 9061f9d
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/main/java/com/github/pedrovgs/problem74/BubbleSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @author Pedro Vicente Gómez Sánchez.
*/
public class BubbleSort implements SortingAlgorithm {
public class BubbleSort extends SortingAlgorithm {

/**
* Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that
Expand Down Expand Up @@ -57,15 +57,4 @@ public void sort(int[] numbers) {
}
}

private void swap(int[] numbers, int i, int j) {
int temp = numbers[i];
numbers[i] = numbers[j];
numbers[j] = temp;
}

private void validateInput(int[] numbers) {
if (numbers == null) {
throw new IllegalArgumentException("You can't pass a null instance as parameter.");
}
}
}

0 comments on commit 9061f9d

Please sign in to comment.