C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 2nd, 2003, 09:52 PM
Da_Maldo Da_Maldo is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 1 Da_Maldo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation How do I sort two dimentional arrays using bubble sort? C++

I'm having trouble trying to sort two arrays on C++, using bubble sort. I have to promt for user ID numbers, then prompt for salary then sort it.

Reply With Quote
  #2  
Old August 10th, 2004, 01:37 AM
arash_partow arash_partow is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 5 arash_partow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello,

Think of your question like this, if I had 2 complex numbers A and B,
how could I tell which one is larger?

The answer is you can't because there is no definitive answer, the reason
being the equality operators only work on 1 dimensional values. So in fact
your problem is not one of sorting 2 dimensional arrays.


Now back to your problem, I think what is need from you is to sort the array
initially according to ID, then where the ID's are similar in the array to
sort according salary.

One interesting property about the bubble sort is that it is a nonvolatile
sorting algorithm, meaning the relative position of elements (similar
elements are maintained during the sorting process).

So in theory if you were to sort the whole array according to the salary
values, then do a whole sort again according to the ID values you will have
maintained the relative position of salaries amongst similar IDs



Arash Partow
__________________________________________________
Be one who knows what they don't know,
Instead of being one who knows not what they don't know,
Thinking they know everything about all things.
http://www.partow.net

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > How do I sort two dimentional arrays using bubble sort? C++


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway