2 Replies - 241 Views - Last Post: 28 March 2012 - 05:44 PM Rate Topic: -----

#1 Dol  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 28-March 12

sorting a given array by applying the Bubble Sort algorithm

Posted 28 March 2012 - 01:18 AM

How do i write a method which sorts a given array by applying the Bubble Sort algorithm, i.e. linearly comparing neighbouring elements and swap them as necessary until the array is sorted. But the given array does not contain elements of type int but contain arbitrary objects (i.e. any object of classes implementing the Comparable interface).
Is This A Good Question/Topic? 0
  • +

Replies To: sorting a given array by applying the Bubble Sort algorithm

#2 ILoveJava  Icon User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 369
  • Joined: 12-March 12

Re: sorting a given array by applying the Bubble Sort algorithm

Posted 28 March 2012 - 03:00 AM

We don't write methods for you. Try searching around on Google for a method on how to do it (I'm sure there is at least one of them out there), then modify it for how you want it, then, if all else fails after that, post back here.
Was This Post Helpful? 1
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8032
  • View blog
  • Posts: 31,202
  • Joined: 06-March 08

Re: sorting a given array by applying the Bubble Sort algorithm

Posted 28 March 2012 - 05:44 PM

Our Tutorial section and the Code Snippets section are full of examples of sorts of all sorts
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1