Editing Talk:399: Travelling Salesman Problem
Please sign your posts with ~~~~ |
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 28: | Line 28: | ||
:::> ''any comparison sort must distinguish between O(n!) lists, and therefore can never do that with less than O(n! -1)=O(n!) comparisons.'' | :::> ''any comparison sort must distinguish between O(n!) lists, and therefore can never do that with less than O(n! -1)=O(n!) comparisons.'' | ||
:::This suggests to me that you've never written a comparison sort. Here's merge sort in JS: | :::This suggests to me that you've never written a comparison sort. Here's merge sort in JS: | ||
− | <pre style="margin: | + | <pre style="margin: 6em;"> |
window.comparisons = 0; | window.comparisons = 0; | ||
function merge_sort(arr) { | function merge_sort(arr) { | ||
− | if(arr.length | + | if(arr.length == 1) {return arr;} |
var left = merge_sort(arr.slice(0, Math.floor(arr.length / 2))); | var left = merge_sort(arr.slice(0, Math.floor(arr.length / 2))); | ||
Line 61: | Line 61: | ||
</pre> | </pre> | ||
:::If what you said was true, modern computer science would collapse. Even if you don't believe me, you have to concede that the mere fact you ''can'' sort 65536 things before the heat death of the universe is proof that you did the math wrong. [[Special:Contributions/173.245.54.28|173.245.54.28]] 03:42, 19 November 2015 (UTC) | :::If what you said was true, modern computer science would collapse. Even if you don't believe me, you have to concede that the mere fact you ''can'' sort 65536 things before the heat death of the universe is proof that you did the math wrong. [[Special:Contributions/173.245.54.28|173.245.54.28]] 03:42, 19 November 2015 (UTC) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |