We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Sorting
- Big Sorting
- Discussions
Big Sorting
Big Sorting
Sort by
recency
|
959 Discussions
|
Please Login in order to post a comment
include
using namespace std;
int main(){ int n; cin >> n; vector unsorted(n); for(int unsorted_i = 0; unsorted_i < n; unsorted_i++){ cin >> unsorted[unsorted_i]; }
}
I implemented my own mergesort in python but I was failing tests due to the conversion from str to int, and int to str.
Fix? Simple, just run the mergesort with strings instead of ints.
include
include
include
using namespace std; bool compare(const string &a, const string &b) { if (a.length() != b.length()) return a.length() < b.length(); return a < b; }
vector bigSorting(vector unsorted) { sort(unsorted.begin(), unsorted.end(), compare); return unsorted; }
int main() { int n; cin >> n; vector unsorted(n);
}
include
include
using namespace std;
int main() { int n; cin >> n;
}