Results 1 to 5 of 5

Thread: Method Help

  1. #1
    pringle is offline Member
    Join Date
    Jan 2008
    Posts
    12
    Rep Power
    0

    Default Method Help

    I have a file listing:

    A customer name
    An account number
    A balance

    each on different lines. I need to sort the file into ascending account number order.
    Do I use a bubble sort for this?

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    I recommend quicksort algorithm when you do it by that example..... or not so huge files...

    Depends on how will you optimize it....

    Its just for me, and kind regards,
    sukatoa.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Sukatoa, how about the bubble sort algorithm. Since he used the account number to sort, may be it's easy.

    Actually why I ask this is that I'm not familiar with the quicksort algorithm at least once. What you think of it.

  4. #4
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    There are several sort Methods.. I'm not sure which one works best though as I haven't used them all.

    For a good example of the Bubble sort, check this out:

    http://www.java-forums.org/java-lang...html#post17238

    If you require more help then please post an example of the file.
    Did this post help you? Please me! :cool:

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by DonCash View Post
    There are several sort Methods.. I'm not sure which one works best though as I haven't used them all.
    Yes it's true. In my experience I used bubble sort in great way, so I know how to use it. Even though I can't do all the things in best way only using bubble sort algorithm. So better to deal with users comments on different sorting algorithms.

Similar Threads

  1. Replies: 2
    Last Post: 03-26-2010, 06:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •