I am trying to write a generic Heap Sort algorithm. I get the following error. What could be the reason?
The type
Tcannot be used as type parameterTin the generic type
or methodHeap.MainClass.MaxHeapify<T>(T[], int, int). There is no
boxing or type parameter conversion fromTto
System.IComparable<T>(CS0314) (HeapSort)
You need to specify the same generic constraint that T must implement
IComparable<T>on theHeapSortfunction as well:You specified this constraint on the
MaxHeapifymethod and in order to call it, T must satisfy this condition.