Note that there are some explanatory texts on larger screens.

plurals
  1. USAlexander Hanysz
    primarykey
    data
    text
    plurals
    1. COIt's a neat idea, but not very robust. There are problems with the fact that vertical arrows cover a narrower range of cells than diagonal arrows, and also with ties being broken according to which arrow is first in the list. Try the second example in my post: you'll get different results according to which arrows comes first in your array, and according to how the arrows line up with the cells underneath them in the spreadsheet. Thanks for the suggestion though—it's possible that some variation on this theme might be useful.
      singulars
    2. COThis looks like a variation on http://en.wikipedia.org/wiki/Knapsack_problem
      singulars
    3. COThere are two things that typically make R run slow. One is `for` loops. You have two nested loops, making (maybe?) around 50 million iterations. Search for the word `vectorise` or `vectorise` for some hints on how to get rid of the loop. The other is R's "copy on modify" behaviour. Each time you do `b[i]=something`, the entire `b` vector gets copied again. The fact that you start with `b=NULL` means that the size of `b` is constantly changing through the loop, which slows things down further. You need to preallocate storage for `b`: again, a bit of searching will give you many hints.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload