Suppose you're using C# and you have a bunch of RSS data that you want to sort and put into a file. Think about how you'd approach the task.

You might consider a generic list. Maybe a DataTable and a DataView. Guilherme's colleague decided on (and invented) the Multi Array Bubble Sort technique.

private string[][] arrTotal;

public void BubbleSort(string[][] arrTotal)
{
  Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

  for (int pass = 1; pass < arrTotal.Length; pass++ )
  {
    for (int i = 0; i < arrTotal.Length - 1; i++ )
    {
      if ( Convert.ToDateTime(arrTotal[i][2])
	       < Convert.ToDateTime(arrTotal[i + 1][2]) )
        Swap(i);
    }
  }
}

private void Swap(int first)
{
  string[][] hold = new string[1][];
  hold[0] = new string[] {
    arrTotal[first][0],
	arrTotal[first][1],
	arrTotal[first][2],
	arrTotal[first][3]};
  arrTotal[first][0] = arrTotal[first + 1][0];
  arrTotal[first][1] = arrTotal[first + 1][1];
  arrTotal[first][2] = arrTotal[first + 1][2];
  arrTotal[first][3] = arrTotal[first + 1][3];
  arrTotal[first + 1][0] = hold[0][0];
  arrTotal[first + 1][1] = hold[0][1];
  arrTotal[first + 1][2] = hold[0][2];
  arrTotal[first + 1][3] = hold[0][3];
}
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!