Skip to content

Commit 4d91d20

Browse files
Renamed method in PancackeSort.
1 parent a5210f6 commit 4d91d20

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/thealgorithms/sorts/PancakeSort.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public <T extends Comparable<T>> T[] sort(T[] array) {
1515
}
1616

1717
for (int currentSize = 0; currentSize < array.length; currentSize++) {
18-
int maxIndex = findMaxIndex(array, currentSize);
18+
int maxIndex = findIndexOfMax(array, currentSize);
1919
SortUtils.flip(array, maxIndex, array.length - 1 - currentSize);
2020
}
2121

@@ -30,7 +30,7 @@ public <T extends Comparable<T>> T[] sort(T[] array) {
3030
* @param <T> the type of elements in the array
3131
* @return the index of the maximum element
3232
*/
33-
private <T extends Comparable<T>> int findMaxIndex(T[] array, int currentSize) {
33+
private <T extends Comparable<T>> int findIndexOfMax(T[] array, int currentSize) {
3434
T max = array[0];
3535
int maxIndex = 0;
3636
for (int i = 0; i < array.length - currentSize; i++) {

0 commit comments

Comments
 (0)