Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

exchange sort algorithm?

Posted on 1997-08-30
4
Medium Priority
?
1,077 Views
Last Modified: 2008-03-03
  I am very new at this! I have a simple? problem. I have a school
assignment that requires me to sort 10000 and 30000 integers in an
array using the following: bubble sort, insertion sort, quick sort
and exchange sort. I have found algorithms for a bubble sort, insertion
sort and quick sort but I have had no luck finding an algorithm to
do an exchange sort. If anyone has code for this kind of sort and is
willing to share - please post.

Thank You,

Kevin Davis Sr.
0
Comment
Question by:kcd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1253837
I guess I'm unfamiliar with the terminology used in your class.
I thought exchange referred a class of sort algorithms including
bubble, quicksort, Shell, heapsort, ...



0
 
LVL 3

Accepted Solution

by:
msmits earned 100 total points
ID: 1253838
A search on 'algorithm + sort + exchange' at altavista.digital.com indeed suggest that exchange is a category of algorithms.  You should actually read the class notes what the exact algorithm is. I believe the fourth URL I got gives a good example of a simple exchange algorithm:

  http://math.nmu.edu/web/Courseware/C/c_052a.htm


0
 

Author Comment

by:kcd
ID: 1253839
Using Borlands C++ 4.5 compiler to comile this program (at the above URL) gave me errors. The sort function declaration and definition are archaic.

As found they read:

void sort( [], int);
void sort( array[], int elements)

When I changed them to read as follows:

void sort( int a[], int);
void sort( int a[], int elements)

the program works perfectly!

msmit,
Thank You for your response. I really appreciate your help with this. I am on the road to finishing my homework assignment.

Kevin Davis Sr.




0
 
LVL 3

Expert Comment

by:msmits
ID: 1253840
Well you have to to something yourself. In programming nothing comes for free.
But you are correct, the stuff is not only archaic, but plain wrong C syntax.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question