Für Vorlesungen, bitte die Webseite verwenden. https://flavigny.de/lecture
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
322B

  1. /* ist in namespace std schon enthalten:
  2. template <class T> void swap (T& a, T&b) {
  3. T t = a;
  4. a = b;
  5. b = t;
  6. }
  7. */
  8. template <class C> void bubblesort (C& a) {
  9. for (int i=a.maxIndex(); i>=a.minIndex(); i=i-1)
  10. for (int j=a.minIndex(); j<i; j=j+1)
  11. if (a[j+1]<a[j])
  12. std::swap(a[j+1], a[j]);
  13. }