Guest User

Untitled

a guest
Jan 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. Input: An array containing the movie titles
  2.  
  3. Declare titles as array
  4.  
  5. Set i,j,minIndex, temp as integers
  6.  
  7. for( set i=0; if i<titles.length-1; increment i)
  8. {
  9.     set String min = titles[i];
  10.     set minIndex = i;
  11.     for(set j = i + 1; if j < n; increment j)
  12.     {
  13.         // If the current array selection is less than the min, swap places
  14.         if(min.charAt(0) > titles[j].charAt(0))
  15.         {          
  16.             set minIndex = j;
  17.         }
  18.         set titles[minIndex] =titles[i];
  19.     }  
  20. }
  21. return titles awway
Add Comment
Please, Sign In to add comment