0

I'm having a problem with my project where I need to read csvfile and convert information to 2D vector and sort the entire columns by rows by selected variable. But I can't find anywhere to put 2D vector into array(not 2D) to do quick sort or another O(n log n) sorting.

I tried to use #include but it is not allowed to use this library.

  • Have you tried [vector](https://en.cppreference.com/w/cpp/container/vector). Could you provide a sample csv. – Kiran Thilak Oct 08 '19 at 05:50
  • With the right custom predicate you can `std::sort()` nearly everything. [SO: C++ Function for Sorting a 2d array of coordinates](https://stackoverflow.com/a/56681848/7478597). (It's about pointers but can be done with `std::vector`s as well.) – Scheff's Cat Oct 08 '19 at 06:10
  • If `#include ` is prohibited then `std::sort()` should probably not used. In this case, you have to resemble it: [Wikipedia: Quicksort](https://en.wikipedia.org/wiki/Quicksort). – Scheff's Cat Oct 08 '19 at 06:14

0 Answers0