View difference between Paste ID: h1UFv28m and Z7PEmzej
SHOW: | | - or go back to the newest paste.
1
static void DoBubbleSort(int[]arraytosort) {
2
	int endingpoint = 1,
3
		temp;
4
	bool issorted;
5
	
6-
	int swaps = 0,
6+
7-
		iterations = 0,
7+
8-
		passes = 0; //debug
8+
9
		for(int i = arraytosort.Length - 1; i >= endingpoint; i--)
10
		{
11
			
12
			if (arraytosort[i - 1] > arraytosort[i])
13
			{
14
				//swap the numbers around
15-
			iterations++; //debug
15+
16-
			//Console.WriteLine("i: " + i + " i-1: " + (i - 1));
16+
17
				arraytosort[i] = temp;
18
19
				issorted = false;
20-
				swaps++; //debug
20+
21
		}
22
		
23
		endingpoint++;
24
	} while (!issorted);
25
26
}