Search
 
SCRIPT & CODE EXAMPLE
 

DART

dart bubble sort

#bubble sort in dart

List<int> BubbleSort(List<int> Arr) {
  bool Sorted = false;
  while (!Sorted) {
    Sorted = true;
    for (int i = 0; i < Arr.length - 1; i += 1) {
      if (Arr[i] > Arr[i + 1]) {
        dynamic Temp = Arr[i];
        Arr[i] = Arr[i + 1];
        Arr[i + 1] = Temp;
        Sorted = false;
      }
    }
  }

  return Arr;
}

void main() {
  List<int> UnSortedArr = [
    1,3,-1000,413,4,321,41,
    324,321,4,31,341,432,4,5
  ];
  
  List<int> SortedArr = BubbleSort(UnSortedArr);

  for (int i = 0; i < SortedArr.length; i += 1) {
    print(SortedArr[i]);
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: NAIRA sign not showing flutter 
Dart :: tooltip flutter 
Dart :: opendrawer without appbar 
Dart :: what is the difference between runapp() and main() in flutter 
Dart :: floting action button tooltip 
Dart :: dart formatter stuck 
Dart :: dart svg drawer 
Dart :: single clone data in flutter 
Dart :: how to mesure execution time of method in dart 
Dart :: flutter try catch ref to the line 
Dart :: flutter assign modify theme 
Dart :: flutter conditional parent widget 
Dart :: * In pubspec.yaml the flutter.plugin.{androidPackage,iosPrefix,pluginClass} keys are deprecated. Instead use the flutter.plugin.platforms key introduced in Flutter 1.10.0 
Dart :: dart list join 
Dart :: flutter circular elevated button 
Dart :: dart remove the last letter in a string 
Swift :: swift ui int to binary 
Swift :: play sound in swift 5 
Swift :: swift pop to specific view controller 
Swift :: How to change the backgroundColor of UIDatePicker or UIPicker ? 
Swift :: use timer swift 
Swift :: rtl ios swift 
Swift :: swiftui textfield multiline 
Swift :: replace character in swift 
Swift :: how to call app delegate function in swift 
Swift :: porsche 
Swift :: swift add programmatically constraint to view 
Swift :: for loop swift 
Swift :: swift pdf thumbnail 
Swift :: button click programmatically swift 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =