codezonediitj / pydatastructs

A python package for data structures and algorithms
https://pydatastructs.readthedocs.io/en/stable/
Other
199 stars 269 forks source link

Added Radix Sort for Positive Integers #451

Closed EmperorArthurIX closed 2 years ago

EmperorArthurIX commented 2 years ago

References to other Issues or PRs or Relevant literature

This fixes issue #319 for positive integers.

Brief description of what is fixed or changed

The code implements Radix Sort on the input array, outputs the sorted array devoid of null/None values

Other comments

The code needs to be improved to accommodate floating point numbers. Currently, the only bug stopping this from happening is:

OverflowError: int too large to convert to float

on explicitly casting digit to int type here:

digit = (num % (10 ** i)) // (10 ** (i - 1)) radix[int(digit)].append(num);