jaigurudev's blog

By jaigurudev, history, 6 years ago, In English

I have an array of N integers (a[N]). I start removing numbers from the array one by one. If at any point I remove an element a[i] and the sum of the remaining numbers is S, then the happiness increases by an amount of S/a[i]. What is the expected value of the total happiness ?

Initial happiness can be considered as 0.

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By jaigurudev, history, 9 years ago, In English

I have studied the theoritical working of various operations on splay trees. But I am not able to find any practice questions on any platforms. Are there any problems to practice. Is it that splay trees are just for theoritical purpose without any practical use — just like AVL or RB trees ?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By jaigurudev, 10 years ago, In English

Can I find any question to practice that require the application of euler totient theorem

Thanks in advance

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By jaigurudev, 10 years ago, In English

Method 1 : for all n belonging to [l,u]{ if(n==2 || n==3) then n is prime and continue for all odd i belonging from 3 to sqrt(n) if i is a factor of n => n is not prime else n is prime }

Method 2: seive of eratosthenes Consider an array a = {2,3,4,...,u} do until array 'a' is non empty{ let x be the first element of 'a' in ascending order remove x and all its multiples from 'a' if x>=l => x is a prime in [l,u]
}

For Any other good methods .. please comment

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

By jaigurudev, 10 years ago, In English

Can any help with an algo that is fast enough to calculate the gcd of two positive numbers. I think one good approach will be to use __gcd of C++ but it is inbuilt, i want to create my own function. Please help...

Full text and comments »

  • Vote: I like it
  • -16
  • Vote: I do not like it

By jaigurudev, 10 years ago, In English

I am beginner to coding and i found a very useful site on this topic

http://www.jahya.net/blog/?2013-05-git-vs-github .. Hope u guys like it

Full text and comments »

  • Vote: I like it
  • -15
  • Vote: I do not like it