File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
lib/features/sorting/selection/view_model Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 11import 'package:algorithm_visualizer/features/sorting/base/view_model/sorting_notifier.dart' ;
2+ import 'package:collection/collection.dart' ;
23
34class SelectionSortNotifier extends SortingNotifier {
45 @override
@@ -25,12 +26,10 @@ class SelectionSortNotifier extends SortingNotifier {
2526 }
2627
2728 if (minIndex != i) {
28- steps.add (SortingStep (index1: i, index2: minIndex, action: SortingStatus .swiping ));
29+ steps.add (SortingStep (index1: i, index2: minIndex, action: SortingStatus .swapping ));
2930
30- final temp = arr[i];
31- arr[i] = arr[minIndex];
32- arr[minIndex] = temp;
33- steps.add (SortingStep (index1: minIndex, index2: j, action: SortingStatus .swiped));
31+ arr.swap (minIndex, i);
32+ steps.add (SortingStep (index1: minIndex, index2: j, action: SortingStatus .swapped));
3433 }
3534
3635 steps.add (SortingStep (index1: i, index2: i, action: SortingStatus .sorted));
You can’t perform that action at this time.
0 commit comments