RTT is always 2*PT.

12 Jan 2017 - 1:55pm

A = O(nlogn), B= O(n)

It is very trivial if you know the complexity concepts.

n=O(nlogn)

17 Sep 2016 - 11:21pm

#include #include int main() { int i; for (i=0; i<3; i++) { pid_t pid = fork(); if (pid == 0) printf("parent:[%d] current:[%d] i=%d\n", getppid(), getpid(), i); else printf("FORK Failed for current: %d\n", getpid()); printf("*\n"); } printf("HI \n"); return 0; }

14 Sep 2016 - 10:22pm

Tricky problem.

13 Sep 2016 - 2:14am

char c= 99 is correct. No compilation error. c can take values from -127 to +127. c=99, if you print with %d in printf, you will see output 99. If you print c using %c in printf, you will see output as c, 99 is ASCII for c.

14 Jun 2016 - 11:32pm

Good approach given above. Another good reading on this matter can be found on this link http://www.techtud.com/resource-share/average-case-analysis

13 Jun 2016 - 6:02pm

Yes both are equal. I hope you understand base of the log is 2.

Lets assume

y = 2logn

log2y = log22logn

log2y = log2n . log22

log2y = log2n. 1

log2y = log2n

So, y = n.

13 Jun 2016 - 5:37pm

1) fun(200) --> as i%2 will be equal to 0, which is false, so else part is executed and fun(fun(199)) is called, from which inner call will take place first i.e. fun(199) and outer function will use value returned by inner call.

2) fun(199) {Inner Call}  --> as i%2 will be equal to 1, which is true, so return instruction is executed. Now return i++ , return original value of i and then increment the value. So the value returned will be 199 and this value will be used by outer call now.

3) fun(199) {Outer Call) --> same as above. The value, 199, returned by this call will be there in Main and printed.

Output: 199.

The concept is explained above.

Execution output can be seen in link: https://ideone.com/8RlhFe

13 Jun 2016 - 1:53am

The easy way to understand and remember locality of reference is Spatial is for Space and temporal for time.