O(n log n) notation for IsIsogram()

I think at best the IsISogram is going to be an O(nLogn) Why? Because we have to sort and compare.
I took a look at the variety of sort functions and only one the bubble sort under best situation has a sort value of N The rest were nY2 or n log n. As we cannot always hope for the best scenario I went with N log N for my choice. Also not to mention we need to compare after sorting to make sure there are no duplicates which probably can be done in an N but adding the two procedures together is what has me with a less optimistic thought towards it being O(n log n)

From the sorts I found:
Merge sort
Bubble
Insertion
Quick
Heap
Counting

The most practical I see is a merge sort as it is O(n log n) across the board.

Privacy & Terms