Note that in practice it might actually be more useful to use your own ( O(n*log(n))) solution. So, if I didn't make a mistake and if the data structures satisfy the above requirements, this solution should be O(n). To get q we calculate map(f,runheads) which is or, equivalently. In the first step we get runheads =, N=6 and heads =, depending on what you chose to store.) To illustrate with an example we look at the case that p =. To be able to get back from q to p we can also store an additional mapping rev with k -> i or even k -> runheads(i) at no extra big-O cost.įinally we apply mapping f to the elements of runheads to get q. a run is a maximal sublist that is an list for some n and m with n k to a mapping f and increase k.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |