
April 16th, 2005, 10:47 AM
|
|
Contributing User
|
|
Join Date: Apr 2005
Posts: 36
Time spent in forums: 3 h 7 m 44 sec
Reputation Power: 5
|
|
|
Index array & sort algorithm???
Hello Everyone.
Just two questionns i wanted to know.
1) can someone explain what is meant by an index array and why its use can improve the efficiency of sorting?
2) Can someone give me a more efficient verson of the sort algorithm below with
reasons why its more efficient??
for (int p = 0; p<n-1; p++)
for (int counter = 0;counter < n-1; counter++)
if (a[counter]> a[counter+1])
swap(a, counter, counter+1);
All help apreciated.
|