How to find the frequency of elements in an array | Java array practice programs | Code Body

Поділитися
Вставка
  • Опубліковано 23 гру 2024

КОМЕНТАРІ • 31

  • @codingHero-h9p
    @codingHero-h9p 3 місяці тому +1

    you are the life saviour, no one in the youtube gives this explanation, thank you.

  • @amrath123
    @amrath123 3 роки тому +9

    Hi.. Space complexity is an issue here, if you use multiple loops approach

  • @gangadharveeravalli6290
    @gangadharveeravalli6290 Рік тому +1

    Finally Im cool with This explanation

  • @rupeshtiwari527
    @rupeshtiwari527 3 роки тому +3

    finally understood thank you

  • @venkatraju2863
    @venkatraju2863 2 роки тому

    thanks mam..understood finally

  • @shivam7164
    @shivam7164 3 роки тому +1

    can we put some other value instead of -1 in (int visited) please tell if possible

    • @CodeBode
      @CodeBode  3 роки тому +2

      The reason for taking -1 is that it should not conflict with any other number in array. If you take any other number and if that number is present in array the output will be wrong so if it is integer array any negative value or value that is not going to be present in array will work

    • @shivam7164
      @shivam7164 3 роки тому

      @@CodeBode so we can take -2 also?

    • @CodeBode
      @CodeBode  3 роки тому

      Yes

    • @livelovelaugh7282
      @livelovelaugh7282 3 роки тому

      How to do this same program using inheritance

    • @thetruth5672
      @thetruth5672 2 роки тому

      @@shivam7164 The idea to take any marker. The value that you know won't occur in array. It can be -10, it can be 100. Etc.

  • @gauravborse7510
    @gauravborse7510 2 роки тому

    super explained thank you

  • @MaheshSharma-ti4pq
    @MaheshSharma-ti4pq 2 роки тому +2

    Getting error with this code...with ArrayIndexoutOfBounds...

    • @alphabee8171
      @alphabee8171 2 роки тому

      it usually happens when you access element greater than array length(keep in mind array indexing starts from 0 to n-1)

  • @Divinetots
    @Divinetots 3 роки тому +1

    best of all ty.

  • @aishwaryalakshmid7416
    @aishwaryalakshmid7416 2 роки тому

    Understood. Thanks.

  • @thetruth5672
    @thetruth5672 2 роки тому

    Awesome

  • @korebhagath3976
    @korebhagath3976 2 роки тому

    Madam element tesukoni explain cheyochuga madam ex array [I] = 2 then process going like that

  • @sachinkore974
    @sachinkore974 2 роки тому +2

    how to solve this que with 0(n)

  • @torkemon
    @torkemon 3 роки тому

    Life saver

  • @mithank2666
    @mithank2666 3 роки тому

    thank you

  • @lamiebevis3189
    @lamiebevis3189 3 роки тому

    Why are u using new array?

  • @gandlasamaikya6626
    @gandlasamaikya6626 3 роки тому

    ❤️❤️

  • @PathimelaArun
    @PathimelaArun 3 роки тому +1

    This is not efficient method as it's gets O(n^2)time complexity

    • @CodeBode
      @CodeBode  3 роки тому +1

      True this is not the most efficient just one of the way to find the frequency. Thanks for the comment. Keep learning!

    • @nityaashukla975
      @nityaashukla975 2 роки тому

      @@CodeBode mam please do the same program with any other method

    • @Technical_Soufpaw_Boxer
      @Technical_Soufpaw_Boxer 2 роки тому

      Not the most efficient way but I don't see your example posted.

  • @Samtsjjsj
    @Samtsjjsj 3 роки тому +4

    copy paste from Javatpoint :p :p