Fix InsertionSort

This commit is contained in:
Samuel Oberhofer 2022-05-23 22:07:33 +02:00
parent f4a7e9913a
commit d3c013052c
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ void bubbleSort(Ware *waren[10]) {
void insertionSort(Ware *waren[10], int sortby) {
if (sortby == 0) {
for (int i = 1; i < 9; i++) {
for (int i = 1; i < 10; i++) {
int j = i;
while (j > 0 &&
waren[j - 1]->getVerkaufspreis() > waren[j]->getVerkaufspreis()) {
@ -24,7 +24,7 @@ void insertionSort(Ware *waren[10], int sortby) {
}
}
} else if (sortby == 1) {
for (int i = 1; i < 9; i++) {
for (int i = 1; i < 10; i++) {
int j = i;
while (j > 0 &&
waren[j - 1]->getEinkaufspreis() > waren[j]->getEinkaufspreis()) {