i thought that if we can take any song from list in one attempt(prob : 1/n) and then have to choose (n-1) different songs + (if i choose that song in two attempt (1/n^2) and then choose n-1 left songs E(x-1)) + ........
and finally i can choose any of the songs from the list as my current song(song that i have choosing 1 time+ 2 times+…) so, multiply my answer by n!
can anyone please explain where i am going wrong!
if possible please give some questions to practice
@Pk301 bro you started coding a month after I started but now you can solve medium-based problems!! I still can only do easy problems. Any tips for me??
i am considering only one song at a time and for the remaining songs i just use the previous answer and so i thought it would be (1/n^2)!
but i know my thinking is wrong
Thanks for looking into it if possible please spent a little more time on this and please figure out mistake !
thanks for this
in my approach E(x) denotes that what will be the expected number of times we listen so as to complete list of x songs. That’s why i am focusing on any 1 song (to start with and in the go if that song is repeated it’s prob is (1/n) ).
But now i understood doing this didn’t make any sense as probability in previous calculation would not be the same!
thanks again ! made my day
No problem mate. I also thought that at first and arrived at E(x) = E(x-1) + n and since this was clearly wrong for x=3 I realized my mistake.
So even if you thought like that your calculation was off(that \frac{1}{n^2}) and you are right to think to multiply by n but you also had to divide it by n, since you want the average.