Solved

Sorting the vectors

Posted on 2003-11-23
3
250 Views
Last Modified: 2010-03-31
Hi

How can I sort the vectors?

Thanks and Regards,
0
Comment
Question by:lakkiprasanna
[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
3 Comments
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9808677
read answers from my previous link (I have given answer there already)

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20095494.html

0
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 25 total points
ID: 9808686

// simple bubble sort.
for (int j=myDateVector.size()-1;j>=1;j--) {
    for (int i=0;i<j;i++) {
         Date d1=(Date) myDateVector.elementAt(i);
         Date d2=(Date) myDateVector.elementAt(i+1);
         
         if (d2.getTime()<d1.getTime()) {
              myDateVector.setElementAt(d2, i);
              myDateVector.setElementAt(d1, i+1);
         }
    } from http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20095494.html
0
 

Author Comment

by:lakkiprasanna
ID: 9808700
actually iam expecting for date sorter only

thanks sudhakar for giving other link also
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
null output 3 42
pagenation logic how it is working in my code 1 69
printf performancy 11 84
Github api to fetch the number of collaborators in a git repo 1 27
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

735 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