You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made an initial implementation for Counting Sort here. If you look at it, you will see that the implementation relies on the fact that the items have a "key" key, representing the numeric key which the counting sort algorithm uses to compare.
This is maybe a good first approach, but I would like to listen to some other ideas. Maybe a bit more extensible.
The first thing that comes to my mind is having a class like NumericKeyItem that has some integer field and a method like get_numeric_key that returns the integer value that the counting sort algorithm should take into account. But maybe this is overcomplicating the implementation if we are going for educational purposes.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I made an initial implementation for Counting Sort here. If you look at it, you will see that the implementation relies on the fact that the items have a "key" key, representing the numeric key which the counting sort algorithm uses to compare.
This is maybe a good first approach, but I would like to listen to some other ideas. Maybe a bit more extensible.
The first thing that comes to my mind is having a class like
NumericKeyItem
that has some integer field and a method likeget_numeric_key
that returns the integer value that the counting sort algorithm should take into account. But maybe this is overcomplicating the implementation if we are going for educational purposes.Beta Was this translation helpful? Give feedback.
All reactions