Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

#1
November 29th, 2012, 04:23 AM
 Ali_Riza
Registered User

Join Date: Nov 2012
Posts: 2
Time spent in forums: 9 m 42 sec
Reputation Power: 0
Given a ABC algorithm as mentioned below

set index = 0

for i = 0 until n

1.1 Set min = x[i]

1.2 for j=i until n

1.2.1 if x[j]<min then

set min = x[j]

set index = j

1.3 set x[index]= x[i]

1.4 set x[i]=min

change the above pseudo code to C program with variable and instructions with 10 integer numbers

Any help would be highly appreciated!

#2
November 29th, 2012, 05:04 AM
 DRK82
Registered User

Join Date: Jun 2009
Posts: 25
Time spent in forums: 1 Day 2 h 41 m 58 sec
Reputation Power: 0
Code:
```index = 0;
for (i = 0; i < n; ++i)
{
min = x[i];
for (j = i; j < n; ++j)
{
if (x[j] < min)
{
min = x[j];
index = j;
}
}
x[index] = x[i];
x[i] = min;
}```

#3
November 29th, 2012, 05:20 AM
 Ali_Riza
Registered User

Join Date: Nov 2012
Posts: 2
Time spent in forums: 9 m 42 sec
Reputation Power: 0
given a ABC algorithm as mentioned below:

Thank you so much dude.such a great help!

 Viewing: Dev Shed Forums > Programming Languages > C Programming > Given a ABC algorithm as mentioned below