473,396 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sorting in vector

Hi

I have a hashtable in wich keys are 9,3,8,4.......7,10,15
wen i sort the keys using vector as:

Vector v = new Vector(hs.keySet());
Collections.sort(v);

now v comes out to be 1,10,15,2,3,4,5....

but i want results after sorting should be:

1,2,3,...,10,15,.....

do suggest how to do it.
Do write code

Thanks'
Atul
Aug 9 '07 #1
2 1312
JosAH
11,448 Expert 8TB
Hi

I have a hashtable in wich keys are 9,3,8,4.......7,10,15
wen i sort the keys using vector as:

Vector v = new Vector(hs.keySet());
Collections.sort(v);

now v comes out to be 1,10,15,2,3,4,5....

but i want results after sorting should be:

1,2,3,...,10,15,.....

do suggest how to do it.
Do write code

Thanks'
Atul
You're talking about Strings that just *look like* numbers, right?

kind regards,

Jos
Aug 9 '07 #2
Hi
Thanks a lot for ur reply.
Sory I came on post very late.
But I got it from ur answer

Thanks'
atul


You're talking about Strings that just *look like* numbers, right?

kind regards,

Jos
Aug 14 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Pratyush | last post by:
Hi, Suppose there is a vector of objects of class A, i.e., std::vector<A> vec_A(N); The class A satisifies all the STL vector requirements. Now I wish to add some attributes for each of the...
3
by: cylin | last post by:
Dear all, After sorting a vector, how to get max in this vector? I got a strange result of my test code. ------------------------------------------------- #include <iostream> #include <vector>...
0
by: Alex Vinokur | last post by:
=================================== ------------- Sorting ------------- Comparative performance measurement =================================== Testsuite : Comparing Function Objects to...
18
by: Matthias Kaeppler | last post by:
Hi, in my program, I have to sort containers of objects which can be 2000 items big in some cases. Since STL containers are based around copying and since I need to sort these containers quite...
2
by: fred_stevens | last post by:
Hi all you C boffins: I need to sort a vector of doubles is ascending order. Qsort will return the sorted vector, but I need a vector of the indices of the sorted vector, not the actual sorted...
9
by: Daz | last post by:
Hello people! (This post is best viewed using a monospace font). I need to create a class, which holds 4 elements: std::string ItemName int Calories int Weight int Density
0
by: SvenMathijssen | last post by:
Hi, I've been wrestling with a problem for some time that ought to be fairly simple, but turns out to be very difficult for me to solve. Maybe someone here knows the answer. What I try to do is...
3
by: Pino | last post by:
HI all, I am learning c++ ( just 1 month) and would want an aid for a code. I have a integer vector of length N. ie 3 3 3 4 4 1
11
by: Trent | last post by:
Running this I see that on first run, both bubble and selection sort have 9 sort counts while insertion sort has ZERO. With a sorted list, should this be ZERO for all? Also bsort and Ssort have...
6
by: Tim Frink | last post by:
Hi, I need some help with STL lists. I've a list with pointers to some objects, let's say std::list< ObjectA* myList. The objects of the class ObjectA all have a function "int...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.