recurrence

Solve recurrence: T(n) = T(n^(1/2)) + Θ(lg lg n) [closed]

非 Y 不嫁゛ 提交于 2019-11-26 20:29:54
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Started learning algorithms. I understand how to find theta-notation from a 'regular recurrence' like T(n) = Tf(n) + g(n) . But I am lost with this recurrence: problem 1-2e: T(n) = T(√n) + Θ(lg lg n) How do I choose the method to find theta? And what, uh, this recurrence is? I just do not quite understand notation

n log n is O(n)?

纵然是瞬间 提交于 2019-11-26 19:06:31
问题 I am trying to solve this recurrence T(n) = 3 T(n/2) + n lg n .. I have come to the solution that it belongs to masters theorem case 2 since n lg n is O(n^2) but after referring to the solution manual i noticed this solution that they have The soluttion says that n lg n = O ( n ^(lg 3 - e)) for e between 0 and 0.58 so this means n lg n is O(n) .. is this right? Am i missing something here? Isn't nlgn O(n^2) ? 回答1: This will explain things better 回答2: n*log(n) is not O(n^2) . It's known as

Should I store dates or recurrence rules in my database when building a calendar app?

孤人 提交于 2019-11-26 18:47:28
问题 I am building a calendar website ( ASP.NET MVC ) application (think simple version of outlook) and i want to start supporting calendar events that are recurring (monthly, yearly, etc) right now I am storing actual dates in my but I wanted to figure out if, with recurrence, does it make sense to continue to store dates (with some obvious cutoff), or should I store the recurrence options and generate the dates on the fly. It got me thinking how outlook, google mail, etc does this or any other

How to solve: T(n) = T(n - 1) + n

会有一股神秘感。 提交于 2019-11-26 17:13:14
问题 I have the following worked out: T(n) = T(n - 1) + n = O(n^2) Now when I work this out I find that the bound is very loose. Have I done something wrong or is it just that way? 回答1: Think of it this way: In each "iteration" of the recursion you do O(n) work. Each iteration has n-1 work to do, until n = base case. (I'm assuming base case is O(n) work) Therefore, assuming the base case is a constant independant of n, there are O(n) iterations of the recursion. If you have n iterations of O(n)

What's the best way to model recurring events in a calendar application?

坚强是说给别人听的谎言 提交于 2019-11-26 07:49:59
问题 I\'m building a group calendar application that needs to support recurring events, but all the solutions I\'ve come up with to handle these events seem like a hack. I can limit how far ahead one can look, and then generate all the events at once. Or I can store the events as repeating and dynamically display them when one looks ahead on the calendar, but I\'ll have to convert them to a normal event if someone wants to change the details on a particular instance of the event. I\'m sure there\

Understanding recursion in Python

心不动则不痛 提交于 2019-11-26 02:24:52
问题 I\'m really trying to wrap my brain around how recursion works and understand recursive algorithms. For example, the code below returns 120 when I enter 5, excuse my ignorance, and I\'m just not seeing why? def fact(n): if n == 0: return 1 else: return n * fact(n-1) answer = int (raw_input(\'Enter some number: \')) print fact(answer) 回答1: lets walk through the execution. fact(5): 5 is not 0, so fact(5) = 5 * fact(4) what is fact(4)? fact(4): 4 is not 0, so fact(4) = 4 * fact(3) what is fact(3