Skip to content

artgl42/Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Algorithms

Sorting algorithms:

  1. BubbleSort
  2. ShakerSort
  3. SelectionSort
  4. GnomeSort
  5. OddEvenSort
  6. InsertionSort
  7. QuickSort
  8. MergeSort
  9. CombSort
  10. HeapSort
  11. ShellSort

How To Use

Step 1

  1. Add this library to any of your projects, using the Solution Explorer -> Add -> Existing Project by right-clicking on the Solution Explorer.

or

  1. Build this library, using the Solution Explorer -> Build Solution by right-clicking on the Solution Explorer.

  2. Copy the created SortingLibrary.dll file to the folder of your project, where the executable file (.exe) is located.

  3. Add reference to SortingLibrary.dll file, using the Reference -> Add Reference by right-clicking on the Reference in Solution Explorer.

Step 2

Use methods of the Sorting Class (the facade pattern):

Available methods Parameters Description
Sort T[] arrayForSort, ISortingMethod sortingMethod Sorting an array using the selected method where T:IComparable
GetRandomArray uint length, int minValue, int maxValue Create and get an array
GetErrorIndex T[] arrayForCheck Check the array and get the index of the wrong element where T:IComparable

Get the sorting time using the Time property of the Sorting Class.

Simple example

var arrayForSort = Sorting.GetRandomArray<int>(100, 0, 100);
Sorting.Sort(arrayForSort, new BubbleSort(());
errorIndex = Sorting.GetErrorIndex(arrayForSort);
var usedTime = Sorting.Time;

Licence

MIT License Copyright (c) 2020 Artem Glushkov

About

Some of the algorithms implemented in the C#

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages