From e1680426ad54596117fe863dac6f87dbfd12cb5c Mon Sep 17 00:00:00 2001 From: LoboTheDark Date: Wed, 4 Feb 2026 15:01:36 +0100 Subject: [PATCH] Update sorting.service.ts --- .../pages/algorithms/sorting/service/sorting.service.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/app/pages/algorithms/sorting/service/sorting.service.ts b/src/app/pages/algorithms/sorting/service/sorting.service.ts index d0972d2..5bb4d6c 100644 --- a/src/app/pages/algorithms/sorting/service/sorting.service.ts +++ b/src/app/pages/algorithms/sorting/service/sorting.service.ts @@ -6,8 +6,6 @@ import {SortData, SortSnapshot} from '../sorting.models'; }) export class SortingService { - constructor() { } - private createSnapshot(array: SortData[]): SortSnapshot { return { array: array.map(item => ({ ...item })) @@ -25,7 +23,7 @@ export class SortingService { for (let j = 0; j < n - i - 1; j++) { arr[j].state = 'comparing'; arr[j + 1].state = 'comparing'; - snapshots.push(this.createSnapshot(arr)); // Snapshot Vergleich + snapshots.push(this.createSnapshot(arr)); if (arr[j].value > arr[j + 1].value) { const temp = arr[j].value; @@ -76,7 +74,7 @@ export class SortingService { private partition(arr: SortData[], low: number, high: number, snapshots: SortSnapshot[]): number { const pivot = arr[high]; - arr[high].state = 'comparing'; // Pivot visualisieren + arr[high].state = 'comparing'; snapshots.push(this.createSnapshot(arr)); let i = (low - 1); @@ -149,7 +147,6 @@ export class SortingService { arr[largest].state = 'unsorted'; } - // Vergleich Rechts if (r < n) { arr[r].state = 'comparing'; arr[largest].state = 'comparing';