Mega Code Archive
Bubble sort
using System;
delegate bool Comparator(object lhs, object rhs);
class MainEntryPoint {
static void Main() {
Employee [] employees = {
new Employee("A", 20000),
new Employee("B", 10000),
new Employee("C", 25000),
new Employee("D", 99999),
new Employee("E", 23000),
new Employee("F", 50000)};
BubbleSorter.Sort(employees, new Comparator(Employee.IsGreater));
for (int i=0 ; i empB.salary) ? true : false;
}
}
class BubbleSorter
{
static public void Sort(object [] sortArray, Comparator gtMethod) {
for (int i=0 ; i