Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Sorting an array?

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
If we have the following two arrays,we need to treat them as two colunms.
int x[]=new int[]{1, 2, 2, 3, 5, 8, 99, 2};
char y[]=new char[]{'h','c','a','b','t','p','m','n'}
i need to sort them based on values in array x and i will get the following:
int x[]= new int[]{1, 2, 2, 2, 3, 5, 8, 99}
char y[]=new char[]]{'h','c','a','n','b','t','p','m'}
then i need to sort charatcers associated with every group of 2s
as :
int x[]= new int[]{1, 2, 2, 2, 3, 5, 8, 99}
char y[]=new char[]]{'h','a','c','n','b','t','p','m'}
when i say the characters associated with the 2 i mean c,a,n
i need them to be in this order a,c,n...
Thanks for your help.

 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't post the same message to more than one forum. You obviously expect to read more than one forum - so do the people who might answer your question. This thread is now closed, all replies to the one in "java in General (advanced)".
 
Hot dog! An advertiser loves us THIS much:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
    Bookmark Topic Watch Topic
  • New Topic