C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 29th, 2012, 04:23 AM
Ali_Riza Ali_Riza is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 Ali_Riza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 42 sec
Reputation Power: 0
Smile Given a ABC algorithm as mentioned below

Please help me to change this algorithm to C language please:

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!

Reply With Quote
  #2  
Old November 29th, 2012, 05:04 AM
DRK82 DRK82 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 25 DRK82 User rank is Corporal (100 - 500 Reputation Level)DRK82 User rank is Corporal (100 - 500 Reputation Level)DRK82 User rank is Corporal (100 - 500 Reputation Level)DRK82 User rank is Corporal (100 - 500 Reputation Level) 
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;
}

Reply With Quote
  #3  
Old November 29th, 2012, 05:20 AM
Ali_Riza Ali_Riza is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 Ali_Riza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Given a ABC algorithm as mentioned below

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap