Sorting structs with constant members
I have a POD struct S
with const
members and a std::vector<S> vec
that I’d like to sort. The following won’t compile:
What does this function “compare( );” in std::qsort() mean or what it does exactly?
I am learning sorting algorithms using C++ , and I want to use ready-made functions in the language libraries. The std::sort(); function is easy to use and understandable, but std::qsort(); I did not understand exactly how it works, especially the comparison function.
C++ Sorting algorithm that sorts every N elements of an array
I am looking for an algorithm that sorts every N element of an array.
Reworking the sorting algorithm for a three-dimensional array
Good evening. It’s been a few days since I’ve been able to convert this algorithm to sort a three-dimensional array. It should sort P two-dimensional matrices by columns “through” the whole array, not each column separately. The whole program code would not fit here, so I attach a small demo version. The algorithm for the vector is working, there are no errors in it. Can anyone help me? I sincerely do not understand what can be the error. Thank you for your time.
How do I adapt this algorithm to a 2D array, so that it sorts the whole matrix across columns?
Code:
Rework the sorting algorithm
it’s embarrassing to ask this, but please could you help me adapt this algorithm to a two-dimensional array, so that it sorts the whole matrix across columns? This is an assignment from my university, the deadline is tomorrow and I can’t get anything done. Thank you for your time.
How to sort an array of strings with different length properly
I have a question about sorting with C#. I want to implement a function to sort an array of strings such as [“AA”, “A”, “Z”, “ZZZ”] alphabetically without any built-in sort methods. I have tried some Compare function and my logic which is comparison between each character of the two strings, but it does not work properly.
std::sort segmentation fault with custom structs [duplicate]
This question already has answers here: Why is the phrase: “undefined behavior means the compiler can do anything it wants” true? (2 answers) Consistency of undefined behavior for a fixed compiler (2 answers) Closed 1 min ago. This sounds like a duplicate question to Sorting a Vector of a custom class with std::sort() causes a […]
Converting string list (7,8,9,10) into integer array, but can’t figure out how to save to double digit value [closed]
Closed 3 hours ago.