Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. namespace app {
  2. void test_thread(void*) {
  3. int n = sizeof(array_for_sort)/sizeof(array_for_sort[0]);
  4. int pmin, i, j=0;
  5.  
  6. dbprintf("rozpoczynam sortowanie dla %d elementow\n", n);
  7. auto totaltime = isix::get_ujiffies();
  8. while(j<n)
  9. {
  10. pmin = j;
  11. i = j+1;
  12.  
  13. while(i < n)
  14. {
  15. if(array_for_sort[i] < array_for_sort[pmin])
  16. pmin=i;
  17.  
  18. dbprintf("%d", i);
  19. i++;
  20. }
  21. int auxvar = array_for_sort[j];
  22. array_for_sort[j] = array_for_sort[pmin];
  23. array_for_sort[pmin] = auxvar;
  24.  
  25. j++;
  26. }
  27. totaltime = totaltime - isix::get_ujiffies();
  28. dbprintf("Koniec, czas: %d\n", totaltime);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement