Hello all!
I have a 2D array of doubles that needs each row sorted in ascending order.
So if my array starts like:
{0.7, 0.6, 0.5}
{0.2, 0.1, 0.3}
{0.9, 0.8, 1.1}
It should end like:
{0.5, 0.6, 0.7}
{0.1, 0.2, 0.3}
{0.8, 0.9, 1.1}
Any idea how this can be coded? New to C++ here and need some help. Thanks!
Try sorting just the first row for starters.
You can use selection sort or bubble sort, both are quite siple. Look it up by yourself.
Can you use std::sort or do you need to implement your own algorithm to do this?