Skip to content

[Explanation/Clarification] radix_sort.cc #1

@omar-s-ta

Description

@omar-s-ta

Hello @nealwu,

First, I'm sorry to do it this way, but I wanted to ask about some points in the radix_sort.cpp file, specifically the radix_sort function.

I was trying to understand the point of some parts of the function, and I was hoping you might help.

  1. First if condition, specifically the RHS of the || operator.
  2. Why are you calculating max_bits and passes this way? I assume the function is generalized to handle -ve numbers too, but this is taken care of in lines similar to lines 54 and 55 in the function.
  3. Second if condition

I'm trying to solve this problem as a practice for radix_sort with a custom base, and was studying/learning different implementations for radix_sort.

Best Regards,
Omar Abdelrahman

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions