Bitwise Operations tutorial #1 | XOR, Shift, Subsets
Part 1 of tutorial on bitwise operations and bit manipulation in Competitive Programming: bitwise AND, OR, XOR, left and right shift, iterating over all subsets of a set. The content is the same as in my Codeforces article codeforces.com/blog/entry/73490. You can find more advanced tricks in TopCoder bits tutorial www.topcoder.com/community/co....
Subscribe for more educational videos on algorithms, coding interviews and competitive programming.
- Github repository: github.com/Errichto/youtube
- Live streams on 2nd YT channel and on Twitch: / errichto2 & / errichto
- FB and Twitter: / errichto & / errichto
- Frequently Asked Questions: github.com/Errichto/youtube/w...
Пікірлер: 154
Erichto please have a series for competitive programming algorithms. It would be really helpful. Nice video.
Thanks for making videos on specific topic. I liked your tutorials on DP and Binary search (On the general way to think where to use this algo.), I would love to see similar videos. Thanks, again!
The best thing about this is, you started from scratch and showed bitwise usage in iterative method. Outclass !
Omg i really need this. Thank you Erricto ❤️
You are so intellingent at the same time so humble and down to earth, thank you for sharing your knowledge. All your videos and blogs are extremely useful.
Got here from LC daily challenge video. Man this is GOLD! Thank you so much for sharing this!
Thank you for taking some of your time to share your knowledge, I'm sure I speak for the whole community when I say it's very appreciated.
Hello Errichto Thank you for all the knowledge. Keep making more videos on Data structures and algorithms.
Thanks you so much Errichto!! Excellent explanation and thanks for all your comments to keep it simple to understand! Greetings from Peru!
Thank you very much! I am preparing for the informatics olympiad and I was searching for exactly these things for a long time.
Thank you so much 🥰🥰 I finally understand how the algorithm to print the binary representation works! You're a such a good teacher
new subscriber because of how well you explained this!!! I'll start watching all your content and see what I can find :D
Thanks! The best explanation for bitwise operations and using bitmasking to solve subset problems.
Thankyou Kamil , detailed videoes on several topics from beginner to high level will be highly appreciated....
Beautifully explained man . Plz add more and more videos on bit manipulation.
This is great. Looking forward to the next one!
Thanks for the videos on bit manipulation Errichto!!
Thanks for this, really helpful video. I found the ending on subsets slightly confusing, and did not understand it, but everything else was great!
your videos are the best one competitive programmer can as for!!!!
your tutorials are awesome !! please make more of them .
Great video as always, but nothing beats listening to your geometry lecture in person at the POI training camp :D
@happyhappyguy5034
4 жыл бұрын
@Hetan Thakkar sorry no
@radian1243
4 жыл бұрын
@Hetan Thakkar no, it wasn't filmed, just listened to as a way of preparation for the POI
Great Video! Waiting for the next lecture :D
Thanks for this tutorial, as I am a beginner it helped me a lot, Waiting for your best lectures/
Can't wait for next one!
Thank you, Errichto, very much appreciated!
This was very informative. Good job!
x % 2 is not exactly the same as x & 1. For non-negative number it is but if your number is negative x % 2 will give you a negative result. For example -5 % 2 = -1 and -5 & 1 = 1. Keep that in mind when you are dealing with negative numbers.
Thanks, man. Waiting for the next part. :)
Great Work Sir...Really Appreciate your work...Please keep on uploading.
Sir...thank you very very much for the great help that you have provided through these videos . I feel very sad that I couldn't get to these videos earlier. Anyway . I love your videos n pattern of teaching . Thanks again a lot❤️
Thanks for your posting. It is excellent as always.
Awesome video!, I would like to see more videos about DP :D
Isn't he lovely? Great explanation straight to the point unlike others💛
This was so nicely explained! Thank you so much. :)
This is the best tutorial for bitwise operation.
a good tutorial , good job Errichto
Sir please have a complete course/series for competitive programming(including data structures and with practice questions) . It would be really helpful.
lotes of love sir please upload all algorithm 💥💥
Very very thank you sir for this video I just subscribed your channel after seeing this video
badly needed this video thanks a lot
thank you Errichto! where could I find exercises like the last one?
*I* *like* *his* *accent*
@Errichto
4 жыл бұрын
Well... thanks, I guess :D
We need 2 part Erricto)!
I needed an entire hour to understand the code, but now I feel like I have the power of god (exactly what a stupid person usually thinks about themself). Thank you Errichto.
Amazing explanation, thank you so much
Excellent examples
This was extremely helpful, thank you
I found many tricky problems with XOR in different contests. A lot can be done on this topic. So if you make a separate video on the tactics and ingenuity of XOR, we would benefit.
@Tarunkumar_Gatla
3 жыл бұрын
Can u share Link of those problems
nice work,love it
Thanks , I was looking for this
Wow,... Really nice video.. I Need this kind of video❤
well you said there is a recursive version of sum of subsets, but first of all i'm not able to come up with a recurrence relation of just finding all the subsets of a given set, i know it's done using recursion and backtracking but just for the mathematical intuition if you can provide with that recurrence relation???
Hey, thanks for the tutorial. What is the point of doing the for loop on 7:02. Are you looking for the similar x values in the 0...30?
Big fan sir...Very nice explanation
Errichto!!!! The Khabib of programming!
I found your binary to decimal converter technique very interesting 3:20
Nice explanation
Very well explained Thank You
thanks, would you recommend books about this topics particularly?
Thankyou so much , It's really helpful
What is the time complexity of the algorithm used ?
what does n denote here? Number of bits which are to be used or number of elements in the array for which subset problem is to be solved.
OMG, that was amazing.
Amazing video! Amazing explanation. Maybe you could do a video on bitwise interesting problems, like, in an array where elements repeat find one that doesnt repeat etc. I enjoy watching your videos
@Zzznmop
4 жыл бұрын
Exzone check out Errichto2 channel live-streams, he covers the whole leetcode “interview prep” series in one, which contains many similar problem types to the one you mention
@RahulPal-mz4oj
4 жыл бұрын
@@Zzznmop Can u please provide the link to that video where he explains interview prep questions
Eager for the bitsets video
last algo was amazing.
in in 32 bit integer if MSB is 1 and left shift is done MSB is lost same as if right shift is done and LSB is 1
Would love to see some bitmask dp later on too :D thanks
Thank you so much, eagerly waiting for part 2
I didn't get how we calcuate the subset values using that loop
suggestion : plz put playlist link as well in the description
sir is bitwise shift valid for negative value
Yes! Much needed
sir can u please explain what do you mean by a[i]?
Thanks a lot Errichto!!
Where do you learn this? I am making computer science and have never even heard of bitwise operations
Can you please suggest the software which you use to create these kind of videos???? Like your own video + the writing thing at one page???
Erichto brother u r writing without seeing down to screen , howzzz u do that buddy... Awesome guidance and teaching from erichto..
Very helpful🤟
Is it possible to get familiar with this??
Programming Legend!
This video is treasure!
thank you so much
Just Awesome!!!
Could you do videos on recursion?
can you make videos on segmented trees implementation it will be very helpfull!!
thank u so much❤
Thanks!
niesamowity!!!!
valuable video
I have a doubt... Is predefined stl library functions such as sum or sort are better or manual algo is better for completive programming?
@adarshverma013
4 жыл бұрын
use stl that will save your time and will be more efficient than your written algo
Can someone help me understand this. He says : 10:35 In the first for loop 'n' is the size of number - lets say 32(bits). 10:45 In the second for loop n is the number of elements in the set set 0
@wannabe945
4 жыл бұрын
n is the array/list size here.
Thank you.
How do you decide that this problem can be solved using bit operation..I know for basic like if we see xor ya or in question we try to use bitwise but how to get intuition for other questions where we don't see any pattern of using bits??
@Errichto
4 жыл бұрын
Just like for any technique: solve a few problems in this topic and then you will start recognizing patterns. Things related to sets and intersections are often solved with bitmasks/bitsets.
You are the best.
I'm having trouble grasping how this problem indicates bitwise operations should be used. it doesn't seem like a bitwise type of problem
Got one question what is a[i], ok I know its the i-th element, though where is a defined ?
@shivambansal1250
3 жыл бұрын
Exactly what i was searching for?
@Danny-007
3 жыл бұрын
I think we assume a as array of n elements....
you are great
Thank U sir...
How should I handle negative number with bitwsie Operation, Errichto?
@Errichto
4 жыл бұрын
What do you want to do with negative values? They are represented in binary system in computer so it's possible to compute their bitwise XOR, etc., but what do you want to achieve this way?
@Mike-mw1fu
4 жыл бұрын
I really need this video. Thanks a billion