Download presentation

Presentation is loading. Please wait.

Published byDeclan Greenhill Modified over 3 years ago

1
Insertion sort void insertion_sort (int a[ ],int N) { int i, j, v; a[0] = INT_MIN; for (i=2; i<=N; i++) { v=a[i]; j=i; while ( a[j-1]>v) { a[j]=a[j-1]; j--; } a[j]=v; }

2
void ordina(int a[], const int n) { int i, j, v, t; for (i=n;i>1;i--) if (a[i-1]>a[i]){ t = a[i-1]; a[i-1]= a[i]; a[i]=t; } // minimo nella prima posizione for (i=2; i<=n; i++){ v=a[i]; j=i; while ( a[j-1]>v) { a[j]=a[j-1]; j--; } a[j]=v; } Algoritmo Insertion sort senza sentinella

3
13 Int Min 3254 i 01 23 4 5 v j Insertion sort NO SI 2 32 1 2 Presentazione realizzata dall’ing. G. Marti v=a[i]; j=i a[j-1]>v a[j]=a[j-1]; j-- a[j]=v i++ 1 il ciclo continua …

Similar presentations

Presentation is loading. Please wait....

OK

2. C# Language Fundamentals

2. C# Language Fundamentals

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google

Ppt on structure of foreign exchange market Ppt on model view controller example Ppt on human resources for class 9 Download ppt on caste system in india Ppt on manufacturing of ball bearing Mp ppt online form Ppt on principles of object oriented programming Ppt on area of trapezium Ppt on online exam system in java Ppt on retail management information system