What is Bitwise Manipulation?

Поделиться
HTML-код
  • Опубликовано: 3 янв 2025

Комментарии • 83

  • @nithishkolli5518
    @nithishkolli5518 5 лет назад +6

    28:58 6 should be written in the binary instead of 7. 011 should have been added to the first bits of binary[2]

  • @varunsaproo4120
    @varunsaproo4120 7 лет назад +15

    I would like you to make a video on how to prepare for competetive programming.
    You are doing an awesome job.
    Once I am good at it. I'll definitely help the community.

    • @gkcs
      @gkcs  7 лет назад +7

      Thats great Varun! Go ahead and best of luck! :-D

  • @raihanbinwahid
    @raihanbinwahid 4 года назад +1

    After watching the video I easily understood Bitwise Manipulation. Thanks bro. 🇧🇩

  • @Virtualexist
    @Virtualexist 3 года назад +2

    13:39 Could have skipped rubbing the zero, this is what happens when we think of efficiency at each step. Loving it, but got 4 ads in 12 minutes. :)

  • @HansBala
    @HansBala 7 лет назад +55

    "It requires 10, 000 bits which no sensible language contains."
    I worship the snake.

    • @gkcs
      @gkcs  7 лет назад +13

      Haha. Yes, Python takes care of many things :-)

    • @udayptp
      @udayptp 4 года назад

      😁

  • @ayushkesarwani4233
    @ayushkesarwani4233 3 года назад

    9:00 we can use log of that number+1

  • @SaurabhP-gm3bt
    @SaurabhP-gm3bt 5 лет назад

    Gaurav, with all respect for this good content, it's really disappointing to see so many ads in the video. Ad in every 3-5 mins! What's going on? It's already hard to concentrate on such topic and ad every every 3-4 mins just disturbs the flow. Really disappointing.

    • @gkcs
      @gkcs  5 лет назад

      I guess RUclips put too many in your view. Hard luck :-/

  • @PremiereHell
    @PremiereHell 2 года назад

    This is how minecraft bedrock stores its chunk pallet keys that map to the nbt pallet.

  • @johnwinchester8537
    @johnwinchester8537 5 лет назад +2

    4:47 , should be 7 3 6 8

  • @SanjitKumar-hw9hd
    @SanjitKumar-hw9hd 6 лет назад +1

    please make video on *How to generate all the possible subsets of a set ?*

    • @gkcs
      @gkcs  6 лет назад +1

      That's a good suggestion, thanks!

    • @SanjitKumar-hw9hd
      @SanjitKumar-hw9hd 6 лет назад

      Yes, using bit masking, and also a video on hamiltonian cycle and path.

  • @attyuttamsaha8
    @attyuttamsaha8 7 лет назад +1

    can you please talk about the various uses of prefix sum logic and how can we understand when to use this tool of prefix sum.. Thanks in advance !

  • @mr.l3260
    @mr.l3260 6 лет назад +2

    Sir could you please tell me how should I manage my time between competitive programming and software development( machine learning and neural networks, web, app dev etc). I have interest in both and in the end only SD is going to help me in solving real world problems. But, Competitive is going to improve my Logical and thinking skills and improve my problem solving. I am currently is third semester and confused between the two..please help.

    • @akshitarora470
      @akshitarora470 5 лет назад +1

      Did you find some way out buddy? It's been an year, maybe you could help :)

    • @mr.l3260
      @mr.l3260 3 года назад

      Wow, it really has been 3 years.
      I divided by time as CP: 25% ,
      Algorithms DS: 50%
      Side projects, CS subjects: 25%
      This worked out really well for me and I got a good internship opportunity and PPO from on campus placements.
      For off campus, I suggest to focus more on CP

    • @mr.l3260
      @mr.l3260 3 года назад

      @@azurnxo2134CP would be practicing on codechef etc., Algos DS would be preparing interview type questions.
      Yeah work on these things and ensure you keep trying diff companies till you get a good job. Don't settle for less

    • @mr.l3260
      @mr.l3260 3 года назад

      @@azurnxo2134 Can't explain.
      Try out questions on CP platforms , read interview exp you"ll learn

  • @tumul1474
    @tumul1474 5 лет назад +3

    your lectures are awesome man !! thanks

  • @shubhamagarwal2998
    @shubhamagarwal2998 4 года назад

    Prabhu ki jai ho
    Aaj samaj aaya kaise "analyse karte hai bit manipulation ke sawal"
    Now its easier to do computer networks

  • @vikaskumar7262
    @vikaskumar7262 7 лет назад +2

    Please make some video tutorials on bitmasking+dp with medium level example not easy level

    • @gkcs
      @gkcs  7 лет назад

      Thats coming out next!

  • @anandinamdar4054
    @anandinamdar4054 7 лет назад +2

    Hello Gaurav thanks a lot that you are taking efforts on such a videos. They are really helpful for us. In the this video At 33.53 you are saying to make a person dead that is making 1 to 0 right? But what if the bit at a given index is already zero? Then it is better to first apply ORing 1 and then XORing again with 1 so that 0 remains zero and 1 becomes 0. Right?
    Another thing is, in competitions on Hackerrank, Hackerearth there are 6 problems first 2 are easy level but from 3 onwards problems are of medium, hard and expert level. So I request you to take such more examples and explain the approach to solve them. It will be really helpful for us.
    Thanks.😊

    • @gkcs
      @gkcs  7 лет назад +1

      Sure Anand, will keep that in mind :)

  • @vivekchadha4109
    @vivekchadha4109 7 лет назад

    we can check whether its 0 or 1 for checking its alive? confusion

  • @kiruthikameenavignesh7658
    @kiruthikameenavignesh7658 4 года назад

    what is the data type of binary_value here ?

  • @ExploringWithAPS
    @ExploringWithAPS 6 лет назад

    @Gaurav Sen
    Sir, can't we traverse the array and check whether the person is alive or dead. Does in this case bit manipulation will give a better time complexity?

    • @gkcs
      @gkcs  6 лет назад +1

      Yes, it's O(1) vs. O(N). Traversing the array isn't feasible for some situations 🙂

    • @ExploringWithAPS
      @ExploringWithAPS 6 лет назад

      @@gkcs thank you so much

  • @bhushandhodi1915
    @bhushandhodi1915 7 лет назад

    Please make some more videos on bit manipulation...

    • @gkcs
      @gkcs  7 лет назад

      Hi Bhushan! Anything that you want to learn about bit manipulation in particular? I tried to put in the most common use cases in this video. :-)

    • @bhushandhodi1915
      @bhushandhodi1915 7 лет назад

      I use java in competitive programming and I am coding since last two years...So it would be great if you show how to save space while declaring arrays of large size like 10^5 elements......And I also want to learn problem solving based on graphs....Thank you :)

  • @madhavgaba7617
    @madhavgaba7617 7 лет назад +2

    Another awesome video, before appreciating bitwise manipulations, i should appreciate you, and i'm keenly looking forward for more videos and if possible please share solution video for august long challenge chef and fibonacci array. Thanks in advance :D

    • @gkcs
      @gkcs  7 лет назад

      Thanks madhav!

  • @sriramkumar6673
    @sriramkumar6673 5 лет назад +2

    Gaurav is like... This is very interesting,let say you wanna kill the person 11. And the smile 😂😂😂🙏

  • @rashibansal7357
    @rashibansal7357 4 года назад

    can you please make a video on how to calculate time complexity
    (consider python as example)

    • @gkcs
      @gkcs  4 года назад

      I have already made one on the channel :)

  • @sudoLife
    @sudoLife 6 лет назад +5

    why not to just write 2^n = 8? It'd be much faster.

    • @sampsonorson
      @sampsonorson 3 года назад +2

      n = log(8)/log(2) is much more faster

  • @SagarGupta-yx8hn
    @SagarGupta-yx8hn 7 лет назад

    Great work, I just wanted to ask where did you learned all these, i.e. some online resource ?? Thanks

    • @gkcs
      @gkcs  7 лет назад +7

      Hi Sagar!
      Most of this has been through participating in contests and interviewing people. But some of this is very recent: I get a video request, prepare on the topic, and then make one :-)

  • @PradeepSingh-ov3bt
    @PradeepSingh-ov3bt 5 лет назад

    data type goes into negative values means?

    • @gkcs
      @gkcs  5 лет назад

      Yes, if there is an overflow or done purposely.

    • @PradeepSingh-ov3bt
      @PradeepSingh-ov3bt 5 лет назад

      @@gkcs happy holi

  • @sampsonorson
    @sampsonorson 3 года назад

    n = log(number + 1)/log(2) = log(8)/log(2) is much more faster. You might need to do a Math.Ceiling(log(8)/log(2))

  • @saimanish7634
    @saimanish7634 7 лет назад

    omg i was solving a problem on codechef which i thought was based on bit manipulation and thinking to check any tutorial for bit manipulation and i see your video.

    • @gkcs
      @gkcs  7 лет назад

      Haha. Coincidence :-P

  • @paesmarca2724
    @paesmarca2724 7 лет назад +3

    could you add subtitle in English, please? I don't understand well

  • @Eli-ph3vq
    @Eli-ph3vq 6 лет назад

    if anyone can suggest some related problems it would be really helpful... i would be able to apply all these. thanks in advance.

  • @techfornoobs4241
    @techfornoobs4241 6 лет назад

    are you friends with cs dojo?

    • @gkcs
      @gkcs  6 лет назад +1

      +Daniel Ro I had a chat with him on Competitive Programming some time back, and found him to be passionate about teaching :-)

    • @techfornoobs4241
      @techfornoobs4241 6 лет назад

      do you think in a technical interview it is worth trying to do bitwise optimization? or should we just stick to standard optimization methods.

    • @gkcs
      @gkcs  6 лет назад

      +Daniel Ro The standard ones are usually enough. This is a little specific to competitive programming.

    • @hackzyoboy2459
      @hackzyoboy2459 6 лет назад

      what are those standard optimization methods?? if anyone can list them plz.

    • @arunkumarmp9185
      @arunkumarmp9185 5 лет назад

      @@gkcs what are the standard optimization method ???

  • @yandiravivancos1162
    @yandiravivancos1162 7 лет назад +1

    Hola!! saludos desde Bolivia porfavor
    habria alguna posibilidad de que en su video tenga traduccion en español?? como subtitulo gracias!!

  • @venkataamareshiragavarapu900
    @venkataamareshiragavarapu900 7 лет назад

    Hi bro. Great Work. Your videos are easy to understand. They make themselves understood automatically :D (True. Not an exaggeration ) I would like to ask for some more :P .. A video on Pollard Rho should be cool. Not many sensible tutorials online. Would be great if you can actually post a video on Pollard Rho and its variants.
    Thanks once again.

    • @gkcs
      @gkcs  7 лет назад +3

      Thanks Venkata! Pollard Rho was used in a contest I had participated in, and I didn't know about the technique then. Would be fun to make a video on this topic! Thanks for the suggestion :-)

  • @mr.l3260
    @mr.l3260 6 лет назад +2

    Yeah I don't even know my binary values... LoL you are cool man!!

    • @mr.l3260
      @mr.l3260 6 лет назад

      Mr. L
      Sir could you please tell me how should I manage my time between competitive programming and software development( machine learning and neural networks). I have interest in both and in the end only SD is going to help me in solving real world problems. But, Competitive is going to improve my Logical and thinking skills and improve my problem solving. I am currently is third semester and confused between the two..please help.

    • @amanraj1608
      @amanraj1608 5 лет назад

      @@mr.l3260 how are you doing now ?

    • @mr.l3260
      @mr.l3260 5 лет назад

      @@amanraj1608 I decided not to study Machine learning! PHd maths students will always be ahead of us in that field.

    • @sandeepreddy211
      @sandeepreddy211 4 года назад

      Which college bro

  • @sankethavoc
    @sankethavoc 7 лет назад

    real good vids !! keep em coming

    • @gkcs
      @gkcs  7 лет назад

      Thanks Sanket!

  • @KrishnaKumar-dw9ix
    @KrishnaKumar-dw9ix 5 лет назад +2

    This is awesome!!!!

  • @VISHALSHARMA-nf5uy
    @VISHALSHARMA-nf5uy 4 года назад

    Thanks sir

  • @CengizAkarsu
    @CengizAkarsu 4 года назад

    so on so forth!

  • @karthiknedunchezhiyan1171
    @karthiknedunchezhiyan1171 5 лет назад +1

    nice dude

  • @balajisv4052
    @balajisv4052 6 лет назад

    111 (|)BINARY_OR of 011 gives you 111! How did you get 1111?

    • @gkcs
      @gkcs  6 лет назад

      Timestamp 😋

    • @balajisv4052
      @balajisv4052 6 лет назад

      @@gkcs 20:30

    • @balajisv4052
      @balajisv4052 6 лет назад

      @@gkcs After the part where you said to use OR operator instead of ADDITION operator to overcome the overflow.

    • @gkcs
      @gkcs  6 лет назад +1

      @@balajisv4052 Please watch the video carefully. The overflow is clearly mentioned, after mentioning the shifting of 3 by 3 bits.

    • @balajisv4052
      @balajisv4052 6 лет назад

      @@gkcs If I'm wrong with my question please explain that overflow optimization method, please.! It means that I didn't understand that part completely.:(

  • @mayanksharma3887
    @mayanksharma3887 7 лет назад +1

    Thanks (:

    • @gkcs
      @gkcs  7 лет назад

      :-)