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

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ค. 2024
  • Hi Guyz,
    In this video, we will see how to find the frequency of elements in an array. Watch the video for the detailed algorithm.
    Happy Learning!

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

  • @amrath123
    @amrath123 2 ปีที่แล้ว +8

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

  • @rupeshtiwari527
    @rupeshtiwari527 2 ปีที่แล้ว +3

    finally understood thank you

  • @gauravborse7510
    @gauravborse7510 2 ปีที่แล้ว

    super explained thank you

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

    thanks mam..understood finally

  • @aishwaryalakshmid7416
    @aishwaryalakshmid7416 2 ปีที่แล้ว

    Understood. Thanks.

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

    Finally Im cool with This explanation

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

    best of all ty.

  • @torkemon
    @torkemon 2 ปีที่แล้ว

    Life saver

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

    how to solve this que with 0(n)

  • @thetruth5672
    @thetruth5672 2 ปีที่แล้ว

    Awesome

  • @korebhagath3976
    @korebhagath3976 2 ปีที่แล้ว

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

  • @mithank2666
    @mithank2666 2 ปีที่แล้ว

    thank you

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

    ❤️❤️

  • @lamiebevis3189
    @lamiebevis3189 2 ปีที่แล้ว

    Why are u using new array?

  • @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)

  • @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.

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

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

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

      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

    • @DarkNationExposed
      @DarkNationExposed 2 ปีที่แล้ว

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

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

    copy paste from Javatpoint :p :p