Difference between revisions of "The Bean Counters"

From CDOT Wiki
Jump to: navigation, search
Line 8: Line 8:
 
# [mailto:cansin@myseneca.ca?/subject=GPU610 Jay Ansin]
 
# [mailto:cansin@myseneca.ca?/subject=GPU610 Jay Ansin]
  
[mailto:ytian38@myseneca.ca,cansin@myseneca.ca?/subject=GPU610 Email All]
+
  [mailto:ytian38@myseneca.ca,cansin@myseneca.ca?/subject=GPU610 Email All]
 
 
  
  
Line 21: Line 20:
  
 
== Select and Assess ==
 
== Select and Assess ==
There wasn't a project source code for this. Everything was written by yours truly.  
+
There wasn't a project source code for this. Everything was written by yours truly. etc. etc. etc.
 +
 
 +
==== Sorting Algorithms ====
 +
The 10 algorithms tested are:
 +
===== bubble sort =====
 +
template<typename T>
 +
inline void bubbleSort(T * array, int size) {
 +
for (int i = 0; i < size; i++) {
 +
for (int j = 0; j < size - 1; j++) {
 +
if (array[j] > array[j + 1]) {
 +
T swap = array[j + 1];
 +
array[j + 1] = array[j];
 +
array[j] = swap;
 +
}
 +
}
 +
}
 +
}
 +
 
 +
===== selection sort =====
 +
template<typename T>
 +
inline void selectionSort(T * array, int size) {
 +
for (int i = 0; i < size; i++) {
 +
int min = i;
 +
for (int j = i; j < size; j++) {
 +
if (array[min] > array[j])
 +
min = j;
 +
}
 +
T temp = array[i];
 +
array[i] = array[min];
 +
array[min] = temp;
 +
}
 +
}
 +
 
 +
===== insertion sort =====
 +
 
 +
 
 +
===== merge sort =====
 +
 
 +
 
 +
===== heap sort =====
 +
 
 +
 
 +
===== quick sort =====
 +
 
 +
 
 +
===== counting sort =====
 +
 
 +
 
 +
===== radix sort =====
 +
 
 +
 
 +
===== bucket sort =====
  
=== Sorting Algorithms ===
 
The algorithms tested are:
 
  
# bubble sort
+
===== shell sort =====
# selection sort
 
# insertion sort
 
# merge sort
 
# heap sort
 
# quick sort
 
# counting sort
 
# radix sort
 
# bucket sort
 
# shell sort ====
 
  
  
Line 42: Line 81:
 
== Parallelize ==
 
== Parallelize ==
  
==== bubble sort ====
+
===== bubble sort =====
  
==== selection sort ====
+
===== selection sort =====
  
==== insertion sort ====
+
===== insertion sort =====
  
  
Line 53: Line 92:
 
== Optimize ==
 
== Optimize ==
  
==== bubble sort ====
+
===== bubble sort =====
  
==== selection sort ====
+
===== selection sort =====
  
==== insertion sort ====
+
===== insertion sort =====

Revision as of 14:02, 2 April 2018


GPU610/DPS915 | Student List | Group and Project Index | Student Resources | Glossary

The Bean Counters

Beans are a cheap commodity, so to count them is a rather silly thing to do. A "bean counter" is one who nitpicks over small things in order to save costs.

Team Members

  1. Yankai Tian
  2. Jay Ansin
 Email All


Projects

  1. sudoku - by Tian Debebe (CMU) not affiliated with Yankai whatsoever
  2. sorting algorithms - Alex Allain cprogramming.com, Animations


Progress

Select and Assess

There wasn't a project source code for this. Everything was written by yours truly. etc. etc. etc.

Sorting Algorithms

The 10 algorithms tested are:

bubble sort
template<typename T>
inline void bubbleSort(T * array, int size) {
	for (int i = 0; i < size; i++) 	{
		for (int j = 0; j < size - 1; j++) {
			if (array[j] > array[j + 1]) {
				T swap = array[j + 1];
				array[j + 1] = array[j];
				array[j] = swap;
			}
		}
	}
}
selection sort
template<typename T>
inline void selectionSort(T * array, int size) {
	for (int i = 0; i < size; i++) {
		int min = i;
		for (int j = i; j < size; j++) {
			if (array[min] > array[j])
				min = j;
		}
		T temp = array[i];
		array[i] = array[min];
		array[min] = temp;
	}
}
insertion sort
merge sort
heap sort
quick sort
counting sort
radix sort
bucket sort
shell sort

Parallelize

bubble sort
selection sort
insertion sort

Optimize

bubble sort
selection sort
insertion sort