Module Sorting

Sorting

Frequency: 10/10

Some points to note:

  • Use built-in sort function (for example std::sort in C++) instead of writing your own sort function.
  • Learn how to use custom comparator for sort function to sort user-defined data types (.i.e struct, class,etc) or to sort primary data types in a different way (for example, sort strings based on their last characters).
  • Using Counting sort may lower time complexity.

Resources

  • Digital Ocean: Using sort() in C++ std Library
  • Wikipedia: Counting sort
  • CPlusPlus: std::sort
  • Problems

    Points Sorting 1002 / 1031 800
    Brewing potion 847 / 920 800
    Smallest possible 917 / 959 900
    Distance minimization 580 / 614 900
    Segment 533 / 563 900
    Cucumber 381 / 481 1000
    Maximum value arrangement 585 / 655 1100
    Buttons game 435 / 497 1100
    Building fence 236 / 400 1200
    Balance 148 / 232 1800