How to get permutation of two halves of given numbers range 1 to n separately and then concatenate.
    2 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    chandra Naik
 le 26 Juil 2019
  
    
    
    
    
    Réponse apportée : Bruno Luong
      
      
 le 26 Juil 2019
            Ex:
suppose
n=10,
n1=1:5
perm(n1)=1,3,4,2,5
n2=6:10
perm(n2)=6,8,7,10,9
perm(n)=concatenate(n1,n2)=1,3,4,2,5,6,8,7,10,9
0 commentaires
Réponse acceptée
  Bruno Luong
      
      
 le 26 Juil 2019
        >> n=10
n =
    10
>> [randperm(n/2), n/2+randperm(n/2)]
ans =
     5     3     4     2     1     7     9    10     8     6
>> 
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Octave dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

