Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 03-08-2009
Member
 
Join Date: Dec 2008
Posts: 51
How to use Bubble sort in C# to sort parallel arraylists

I have list of array element and i wanted to apply the Bubble sort on the array element , here i will provide those array element so you will come to whether i could use the bubble sort to sort parallel arraylists.

double revenue[] = {2513.84, 7816.39, 7236.56, 2158.69, 4532.86, 1354.72, 514.75};
Reply With Quote
  #2  
Old 03-08-2009
Member
 
Join Date: Mar 2008
Posts: 232
Re: How to use Bubble sort in C# to sort parallel arraylists

It seems that you did not try to solve it. Think of an ArrayList as a resizable one-dimensional array of objects. In addition to automatic resizing, ArrayList has a few other advantages over Array.First do it by yourself and let us know if you stuck somewhere by posting your code and error stack . Also do not look for a code, designed and developed by someone else other wise you will not learn ever.
Reply With Quote
  #3  
Old 03-08-2009
Member
 
Join Date: Dec 2008
Posts: 161
Re: How to use Bubble sort in C# to sort parallel arraylists

ArrayList has three constructors. The default, parameterless, constructor creates an empty ArrayList that has a default initial capacity of 16 items. Start the iteration at list.size() - 1 because array (or ArrayList) elements are numbered from 0 up through 1 less than the size of the list. There also is a constructor that allows you to specify the list's initial capacity. The final constructor takes an ICollection interface reference, and copies all the items from the collection into the new ArrayList.
Reply With Quote
  #4  
Old 03-08-2009
Member
 
Join Date: Jan 2009
Posts: 143
Re: How to use Bubble sort in C# to sort parallel arraylists

I believe the fault is the fact that the '[' character is replaced by "c[" due to some error in the [code] constructor inside the web-script hosting
this forum.

Start the iteration at list.size() - 1 because array (or ArrayList) elements are numbered from 0 up through 1 less than the size of the list. This is a fairly standard idiom:

for(int j = list.size() - 1; j >= 0; j--){
// whatever
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use Bubble sort in C# to sort parallel arraylists"
Thread Thread Starter Forum Replies Last Post
How to sort the name in Excel Sanju Baba Windows Software 1 06-01-2012 10:53 PM
What is bubble sort in data structure punguzhali Software Development 3 04-01-2011 03:49 AM
What is the difference between binary tree sort and heap sort in data structure sRIPRIYA Software Development 3 04-01-2011 01:25 AM
How the sort() can be used in CPP programming Servant Software Development 5 25-02-2010 05:42 PM
How to sort a datatable Udayachal Software Development 6 23-01-2010 01:23 PM


All times are GMT +5.5. The time now is 07:15 PM.