Results 1 to 4 of 4

Thread: How to use Bubble sort in C# to sort parallel arraylists

  1. #1
    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};

  2. #2
    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.

  3. #3
    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.

  4. #4
    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
    }

Similar Threads

  1. How to sort the name in Excel
    By Sanju Baba in forum Windows Software
    Replies: 1
    Last Post: 06-01-2012, 10:53 PM
  2. What is bubble sort in data structure
    By punguzhali in forum Software Development
    Replies: 3
    Last Post: 04-01-2011, 03:49 AM
  3. Replies: 3
    Last Post: 04-01-2011, 01:25 AM
  4. How the sort() can be used in CPP programming
    By Servant in forum Software Development
    Replies: 5
    Last Post: 25-02-2010, 05:42 PM
  5. How to sort a datatable
    By Udayachal in forum Software Development
    Replies: 6
    Last Post: 23-01-2010, 01:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,063,794.32331 seconds with 17 queries