SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::fmt::Debug;
  2. use std::cmp::PartialOrd;
  3.  
  4. fn main() {
  5.     let mut l = vec![5,3,6,1];
  6.     println!("{:?}", selection_sort(&mut l));
  7. }
  8.  
  9. fn selection_sort<T>(list: &mut [T]) -> &[T]
  10.     where T: Debug + PartialOrd{
  11.    
  12.     for (i, e) in list.iter().enumerate() {
  13.         println!("{:?} {:?}",e, i);
  14.        
  15.         for (ii, ee) in list[i..].iter().enumerate() {
  16.             println!("-------- {:?} {:?}",ee, ii);
  17.         }
  18.     }
  19.    
  20.     list
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top