Solved

Sorting the vectors

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

How can I sort the vectors?

Thanks and Regards,
0
Comment
Question by:lakkiprasanna
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Spring Controller - inheritance in request parameter 3 38
countPairs challenge 7 58
topping2 challenge 13 62
word0 challenge 4 54
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now