Find number of ways to partition a set with N elements into K sets

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 55

  • @memansi0007
    @memansi0007 4 ปีที่แล้ว +10

    In DP solution , for second loop.. the termination condition should be j

    • @RaviYadav-xg2hy
      @RaviYadav-xg2hy 4 ปีที่แล้ว

      yeah correct.... I was also thinking the same...thanks for pointing it out !!

  • @shreyasingh1258
    @shreyasingh1258 4 ปีที่แล้ว +6

    inn the dp solution table is filled wrong,u have always took dp[i-1][j-1] as the upper element and not upper diagonal one, U may check it out! very helpful video it was

  • @randomclicks6466
    @randomclicks6466 4 ปีที่แล้ว +4

    last output it will be 6 but it will be 3*1+3=6 also dp[4][2] will be 2*3+1=7

  • @shyamfaguna485
    @shyamfaguna485 5 ปีที่แล้ว +7

    sir you have computed the last row wrong plzz do check.....overall good video helped a lot very nicely explained specially the part which i was confused the most of how the s(n,k) formula came got cleared

    • @techdose4u
      @techdose4u  5 ปีที่แล้ว +1

      Thanks for pointing out.... I will check it out.

    • @mukeshchauhan2354
      @mukeshchauhan2354 3 ปีที่แล้ว

      I think 3*3+1 =10 will be in last box as per sir explanations.

  • @aakashgoswami8895
    @aakashgoswami8895 4 ปีที่แล้ว +2

    Not all heros wear cap.... Thanku sir. Continue with such great quality videos :).

  • @arvindrawat3641
    @arvindrawat3641 3 ปีที่แล้ว +1

    dp[4][2]= 7 {the no. of times 2 sets can be made from 1,2,3,4} ie, {1, {2,3,4} }, {2, {1,3,4} }, {3,{1,2,4}}, {4, {1,2,3}}, {{1,2}, {3,4}}, {{1,3}, {2,4}}, {{1,4}, {2,3}} but u have writtern 5 . please clarify

  • @swetajha2265
    @swetajha2265 4 ปีที่แล้ว +2

    Very nice explanation. Thanks..Keep making such videos. Very easy to understand.

  • @stablesort
    @stablesort 4 ปีที่แล้ว +1

    Nice video. I wonder if there is direct formula that could calculate the answer without any need to construct the table? From the first glance, it looks like a variation of Pascal's triangle.

    • @manojpandey7517
      @manojpandey7517 4 ปีที่แล้ว +1

      Interviewer won't be pleased even if a direct formula exists.

  • @harshmankodiya9397
    @harshmankodiya9397 ปีที่แล้ว

    Wouldnt even nearly consider this as a good explanation...

  • @kashifanwar9733
    @kashifanwar9733 4 ปีที่แล้ว +1

    so easy it becomes when u explain

  • @MrThepratik
    @MrThepratik 4 ปีที่แล้ว +1

    thanks much , really appreciate your effort

  • @tushargupta3236
    @tushargupta3236 3 ปีที่แล้ว +1

    Great recursive formula explanation!

  • @tarushiarora6887
    @tarushiarora6887 4 ปีที่แล้ว +3

    Thank u very much it was an amzing video

  • @Mandeepsingh-jo5cf
    @Mandeepsingh-jo5cf 3 ปีที่แล้ว +1

    thank you sir

  • @revarevanth1800
    @revarevanth1800 4 ปีที่แล้ว +1

    Thank you so much

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว

      Welcome :)

    • @revarevanth1800
      @revarevanth1800 4 ปีที่แล้ว

      @@techdose4u any plans to prepare for PayPal coding

  • @mayanktripathi3915
    @mayanktripathi3915 5 ปีที่แล้ว +2

    If n numbers will be same than what changes have to do

    • @techdose4u
      @techdose4u  5 ปีที่แล้ว +1

      N-1CK . Think about it and let me know. I am almost certain about it, though not 100%.

    • @amulyareddyg9290
      @amulyareddyg9290 4 ปีที่แล้ว

      @@techdose4u N-1 C K-1

  • @anushikeswani297
    @anushikeswani297 3 ปีที่แล้ว

    The table is not filled according to the formula..plz check....there are also some calculation mistakes...
    Video was helpful though

  • @anshuofficial166
    @anshuofficial166 3 ปีที่แล้ว

    There is some mistake during filling table?

  • @moelayo
    @moelayo 4 ปีที่แล้ว

    This is stirling numbers of the second kind.

  • @dhanyaabharadwaj1376
    @dhanyaabharadwaj1376 4 ปีที่แล้ว +1

    Thanks TECH DOSE

  • @ravishasharma7
    @ravishasharma7 3 ปีที่แล้ว +1

    Can you tell how to print all such partitions, not just count the number of ways?

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว

      Save the partitions in array of list

  • @rahulanand141
    @rahulanand141 4 ปีที่แล้ว

    The j in the solution should be up to k+1 not i+1 otherwise j will be out of the index.

  • @abhisheksable622
    @abhisheksable622 4 ปีที่แล้ว

    if we are introducing nth element than it will generate k possibilities so why we are myltiplying k instead of adding it

  • @kriativt2794
    @kriativt2794 3 ปีที่แล้ว

    Why can not i just juse nCk formula to find no. Of ways k elements can be selected using n elements.

  • @kakaninavin
    @kakaninavin 4 ปีที่แล้ว

    Sir in last condition you said S(4,3)=2*3+1=7 but you said that is 6 ?

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว

      I must have said by mistake

  • @fb_a
    @fb_a 5 ปีที่แล้ว

    Why not a combination?
    ==> C (n,k)
    Why it is differ from combination.?
    =>which case I am missing ?

    • @techdose4u
      @techdose4u  5 ปีที่แล้ว +1

      I am very busy right now and i forgot this video as well 😅 please find something yourself for the time being.

  • @aravindravva3833
    @aravindravva3833 4 ปีที่แล้ว

    is no of ways is n C k ?

  • @sakshamnayyar6302
    @sakshamnayyar6302 5 ปีที่แล้ว +1

    what if all numbers in the array are the same ?

    • @techdose4u
      @techdose4u  5 ปีที่แล้ว

      N-1CK . Think about it and let me know. I am almost certain about it, though not 100%.

  • @hrishikeshpanse4790
    @hrishikeshpanse4790 4 ปีที่แล้ว +1

    this is wrong

  • @naroe3657
    @naroe3657 ปีที่แล้ว

    thank you so much