4
votes
Accepted
Multithreaded bogosort in Rust
List of improvements I would make:
I'm uncertain why you use Arc::clone(...), just use .clone() directly. Same for ...
3
votes
Sort and search vectors by different criteria
Unnecessary sorting of data
You should be able to find the desired items in \$\mathcal{O}(N)\$ time without needing to sort the container multiple times. You can just linearly go through the items in ...
2
votes
Find first and last matches on a sorted list
Binary search
This should be a binary search as that is the expected algorithm. Why? because the array is sorted. Your function does not take advantage of the fact that the elements are sorted. ...
2
votes
Accepted
Partitioning a list so that even numbers appear before odd numbers
welcome to the Rust community!
Your code is already quite idiomatic. You may use an unsafe and unstable feature to improve efficiency, swap_unchecked. It's only ...
2
votes
Multithreaded bogosort in Rust
You definitely want access to shared stuff to be read-only in the normal case so multiple threads can do it in parallel. Reading a lock-free atomic simply works that way, unlike taking a lock around ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sorting × 1126algorithm × 315
java × 260
python × 206
c++ × 187
performance × 141
mergesort × 139
javascript × 127
beginner × 105
array × 94
c × 93
c# × 84
quick-sort × 74
python-3.x × 59
insertion-sort × 46
programming-challenge × 44
c++11 × 32
reinventing-the-wheel × 30
strings × 28
recursion × 27
time-limit-exceeded × 25
radix-sort × 25
php × 24
ruby × 22
python-2.x × 21