@Juan2003gtr your GTR needs a new transmission Juan, ve te a la chingada
@pwn0x805 жыл бұрын
Yep better watch xorpd assembly lecture
@ohdude66434 жыл бұрын
Boomm drop da maik
@3deeguy3 жыл бұрын
@@pwn0x80 Thanks. I just subbed xorpd. I tried to read some code that had a lot of bit shifting.
@dorondavid46984 жыл бұрын
Great video, but the masking section was done too quickly... You needed a bit more in depth examples for each type.
@FWTteam4 жыл бұрын
It's all the bits and pieces into one video, represented very interestingly. Thank you!
@RagingWhoremoans4 жыл бұрын
I'm still trying to compute all of this information. It's a bit overwhelming.
@SK-yb7bx3 жыл бұрын
wah wah whaaaaa
@ivanleon61643 жыл бұрын
shift to another things and then come back to continue w the video.
@shanmukh1113 жыл бұрын
It's a "bit" too much I agree
@SkeleCrafteronYT3 жыл бұрын
You need the basics of binary to understand. It will help to learn binary conversion to hexa-decimal and base-10. Also learning "signed" binary, will help with understanding the twos complement which I think she explained quite well. You'll get there!
@enesabdulla58723 жыл бұрын
@@SkeleCrafteronYT @Ivan Leon I think the person was making a joke (a 'bit' overwhelming).
@simplelife87223 жыл бұрын
I came to youtube understand bit manipulation after reading first chapter of your book.... And boom I have the author explaining me herself... Thank you soo much Gayle😀
@KentoNishi6 жыл бұрын
I'm a *bit* interested
@esjihn4 жыл бұрын
just a little bit
@toddchaney24544 жыл бұрын
@@esjihn Not a tad bit though.
@devprakash53203 жыл бұрын
naughtyy!!
@uncaged30763 жыл бұрын
nice
@laurenortiz21206 жыл бұрын
This REALLY helped clarify the shifting and mask business for me. Thanks!
@HackerUC6 жыл бұрын
I got a little lost at 7:23 when she starts talking about shifting the number to the left by i spots
@shanthureddy42345 жыл бұрын
yeah exactly she didnt bother to explain why original number % (random) mask should not be zero in the first place ,,,
@ohdude66434 жыл бұрын
What you need to keep in mind is: if you shift too much to the left, you end up with communism. Too much to the right you've got a Facist state. Neither are good.
@gulammohiddin57474 жыл бұрын
The part you mentioned was regarding getting the bit at the 'i' th position. To get that bit we need to do a Bitwise AND with the binary number which has 1 at the 'i'th position. So to create that binary number we take 1, which is represented as 00000001, shifting the 1 to 'i'th position, (which gives 00100000 in the video, actually depends on i) and do a bitwise AND with the binary representation of the given number. If the result is a zero then you know that the 'i'th bit is zero else its a 1.
@ognimoddd4 жыл бұрын
don't you mean a little BIT lost?
@edgar67053 жыл бұрын
@@gulammohiddin5747 Hi Gulam, so you always start with one and then start shifting?
@shankar7435 Жыл бұрын
After watching several videos of others, I finally landed on the right one, which is precisely what I was looking for. Thanks a lot.
@quirkyquester4 жыл бұрын
the best video talks about bit operation i've ever found! Thank you so much!
@rydmerlin Жыл бұрын
It has to be said Gayle is a superwoman. Looking at what she was wearing it appears as though she did this series of videos in the same day and that’s just amazing to me that she can offer this instruction like that.
@mj-sv7ep4 жыл бұрын
At 2:45, she says "So let's think about this. What number would we have to add to 00 100 10 to get 1 000 000 0." I know about 2s complement, but I donot get why we need to get 1 000 000 0?
@led07zeppelin4 жыл бұрын
1. convert 123 to binary. 2 Invert bits, and then add 1. Why do we add one? 4:22
@edgar67053 жыл бұрын
I think 1(0000001) is the number you need to add to your inverted number so you can get the negative version of 123
@MonjurulIslamKhan7 жыл бұрын
For 2's complement, you don't have to do that much work. Just keep same all the bits till you encounter first 1 from right to left. After first 1 complement each bit. For example, 010100 -> xxx100 ->101100. :D
@Pignemo6 жыл бұрын
but that's a slower algorithm than inverting the bits and adding one.
@ghostriley226 жыл бұрын
I think it's faster on paper but slower for the computer
@RickeyBowers5 жыл бұрын
Subtracting one and then inverting the bits also works - each of these methods have utility depending on the environment. For example, they could simplify a more complex bit twiddling, or have dedicated hardware. Thanks for sharing this alternative.
@JackWootton5 жыл бұрын
If anyone tries this in Python, be careful because shifting 1 "i times" will not provide the correct bit mask for the "i th" bit: 1
@solisoma1012 Жыл бұрын
let your counting start from 0 down to the left
@zongweifan23534 жыл бұрын
you helped me get much more clear with the bit manipulation things, thanks!
@cbade9932 жыл бұрын
She understands English, Spanish, Russian and Korean given the books on her desk?
@snlgrg7 жыл бұрын
explanation of concept is very good but only one thing is missing i.e some real world problem, just introduce some real world problem without solution, You can post solution in some other video.. ;)
@jorgeherrera10747 жыл бұрын
go to their website and sign up and you'll have examples, really worth it, just signed up a few days ago, probably the best free help ive found
@ryantay877 жыл бұрын
Completely agree. Been doing the 30 day code challenge to better myself.
@MarioRugeles7 жыл бұрын
snlgrg your concern is fair, altough I would also encourage you to dive more into the conceptual approach just for fun. Real world applications will always be there waiting 😀
@shanthureddy42345 жыл бұрын
check out the geeks for geek
@SoyJayP5 жыл бұрын
Excellent video. It feels good to finally understand something about Bit Manipulation
@DarkSpydaIV3 жыл бұрын
Very wordy and much technical jargon. Hard to follow for someone new to the topic. The curse of knowledge means that the more you know, the easier it is to talk like an expert and alienate non-experts. The way to explain this bit manipulation information to beginners is to keep it in very simple wording. Such is understanding your audience and who is receiving the information. If that audience is people who are new to the topic, they will be lost in translation.
@emilyhuang27594 жыл бұрын
8:19 for big picture of getting, setting, and clearing
@kevinrodriguez74034 күн бұрын
does she show us how to actually add "1" to the binary inverse of the positive binary representation? like its a pretty big step she just glosses over
@ashutoshbichare5 жыл бұрын
Number:23 Left shift:Number*2=23*2=46 Right Shift:Number/2=23/2=11
@SJHunter863 жыл бұрын
Hey :) Just so you can see why its -12: 1 1 1 1 0 1 0 0 in artihmetic base 10 numbers works out to be: -128 + 64 + 32 + 16 + 0 + 4 + 0 + 0 = -12 When the signed bit is a 1, the value is -128, then you add left to right as usual. Hope this helps!
@OhhOmni4 жыл бұрын
@8:12 when Gayle is explaining how to "clear the ith bit", she mentions that all you have to do is invert your existing binary number, then AND it with the inverted number. But if you pay attention, you will see that she doesn't invert the two 1's near the right side of the binary number. Does anyone have any idea why she may have done it this way?
@design48art4 жыл бұрын
OhhOmni I had the same question. Hopefully someone can chime in with some insight
@graham57744 жыл бұрын
"AND it with a mask with a 1 everywhere else but that one spot". She then said to get this by inverting the previous mask, not the existing number.
@cooldeep74925 жыл бұрын
Jump to the 5:20 if you want to know the difference between logical and arithmetic right shift.
@kardashevr4 жыл бұрын
9:00 The only thing I understood 100%
@ohdude66434 жыл бұрын
So that's about what? 2 maybe 5% of the whole?
@acymiranda4 жыл бұрын
hahahaha
@SharronDenice3 жыл бұрын
Lol this tickled me so
@satyamsingh46534 ай бұрын
in clearing the bit, the invert bits are wrong at the 3& 4th place?
@sakshamjain69003 жыл бұрын
you guys provide a great explanation, but I still think you need to go a little slower so the people can understand it much better and please try to explain videos in depth a little bit ;)
@blank3366 жыл бұрын
so how can you tell the difference of -123 and 133 in binary? they both are 10000101
@APaleDot6 жыл бұрын
This is where the distinction between signed and unsigned integers comes in. If the data-type we're talking about is an unsigned 8-bit integer, then 10000101 is 133. If it's a signed 8-bit integer, then 10000101 is -123. Unsigned 8-bit integers can be in the range 0 to 255. Signed 8-bit integers are in the range -128 to 127. Both can hold 256 different values, but the signed ones are centered around zero.
@OhsoLosoo2 жыл бұрын
@@APaleDot clearest explanation I've seen on this in a while.
@MURDR637 жыл бұрын
Couldn't you just use x^1
@Alexander.Kravchenko3 жыл бұрын
No, it wil invert nth bit instead of clearing
@mohanaddarwish23076 жыл бұрын
Did anyone got interested about the pile of books behind her and if they are well known or just decoration?
@aishwaryaramesh48776 жыл бұрын
They are indeed well known books! She has authored two of them, the other books are like Bible: CLRS, Algo design from Springer , etc.
@mohanaddarwish23076 жыл бұрын
Aishwarya Ramesh if you are free can you share their names? If you u know them or can read it from the video :)
@aishwaryaramesh48776 жыл бұрын
@Mohanad Darwish , sure! Cracking the Coding Interview, Cracking the tech career , CLRS , Algorithm Design by Springer, some Russian book and I'm not sure about the others... Hope that helps
@imsubratabiswas Жыл бұрын
what she told from 3:38 ? little confusing. can anybody explain ? why to add 1 to both of those ?
@icono__71363 жыл бұрын
You introduced the concept of "inverse" without even defining it. What does inverse mean??
@Sxhd2 жыл бұрын
for the twos component you said we just add the inverse so why did you put a 1 if there's already a 1?
@aysehasan84025 жыл бұрын
what about when you shift a negative number to the left ?
@bradfin122 жыл бұрын
Depends on if it is logical or arithmetic. Logical will push the last bit before the sign bit. Arithmetic will multiply the number by two and keep the sign bit.
@crackcodinginterview49954 жыл бұрын
Very clear! Would have been great if it is shown with coding examples.
@ryzen9804 жыл бұрын
Atleast the voice in this video is clear
@SahilRallySuperStar7 жыл бұрын
Which software are you using to explain things ?
@johnaweiss7 ай бұрын
7:23 I don't understand this notation. (x&(1
@johnaweiss7 ай бұрын
ok, i think `x` is the byte we're evaluating, and `
@_ashout7 жыл бұрын
In the last example @8:20, could you not shift a 0 instead of inverting a 1? So (0
@PepeTostado2 жыл бұрын
Are there coding challenges (excercises) that deal with bit manipulation? To nail the foundations.
@jackwindensky56062 жыл бұрын
Go to leetcode and filter the problems by bit manipulation, I recommend then sorting by most frequent so you are more likely to find an accompanying video tutorial on youtube if you get stuck.
@sachiniyer71484 жыл бұрын
Thanks.. Yours lectures have been very helpful!!
@IChowdhury013 жыл бұрын
7:20 is the !=0 necessary? Wouldn't just returning the result also work? If it's a 1, 1 != 0 is 1. If it's a 0, 0 != is 0.
@barisbasar39092 жыл бұрын
This lady is lowkey one of the biggest g's in coding lol
@asawanted2 жыл бұрын
Regarding clearing the ith bit, can't we do x xor (1
@Saykey201113 жыл бұрын
where did you get that 637. You to explain for those who are not gifted too.
@ryangriffin50363 жыл бұрын
It's a random number that she chose because it nicely demonstrates "carrying the one"
@namankeshari7332 Жыл бұрын
The legend herself!!
@quirkyquester4 жыл бұрын
how do you flip the bit in python? "~" in python does not flip the bits
@magnuschase26944 жыл бұрын
Hello so when i want to use the arithmeric shift to the right for example on 1011 then i get 1101 and by 0101 i get 0010?
@sunnyhours847 жыл бұрын
Whatta hell?? How ignorant I have been! I've never had to deal with bit operations until now, but I have always presumed that you just use the exact same bits (except the first sign bit) to differentiate between positive or negative numbers. Like say the number 18 in base 10 is 00010010, and -18 is 10010010. Why is this a bad idea, someone?
@sunnyhours847 жыл бұрын
Thanks a bunch for the answer! I've been reading up on different signed representations after my first post, and turns out that some architectures actually do use the "magnitude representation", but they are outdated, so my hunch was not totally wrong. Looks like all modern x86/x84 machines uses "two's complement".
@jvsnyc6 жыл бұрын
Not just those, but 19 of 20 others are thereabouts as well.
@homotopf94615 жыл бұрын
@@sunnyhours84 yeah it is not a stupid idea, in your own project you can totally do somethings like that!
@geraldinejns6 жыл бұрын
Never mind, got it. It's just an example of how to add up 2 digits. Can't believe i had to watch the video twice to get it.
@azatakhunov6061 Жыл бұрын
good video) after watching this i took a certificate at HackerRank
@bnetjail6 жыл бұрын
What is "Bitpul Ian Man Tio" ?
@ankitatrivedi66924 жыл бұрын
Bit manipulation :-)
@antoniotorga53713 жыл бұрын
great video LOVING this channel
@jvsnyc6 жыл бұрын
This is solid, but I've been somewhat impressed how tricky some of the more advanced bit manipulation problems on HackerRank can get even for someone who's known the basics for years. Sure, you know XOR, but do you REALLY know XOR....
@trainofthought57334 жыл бұрын
how is arithmetic shift of -23 12 i does not work bit wise right??
@ultimatesin35446 жыл бұрын
When is this practical? You know I saw this used in some Google code for a particular object in Android SDK a while back, and it looked like the developer was trying to be clever in squeezing every last bit of efficiency possible out of his/her algorithm.. however if you extended their object in a certain way (which was for a popular use-case at the time) the algorithm then broke for certain situations causing a very elusive bug.. I wish I remember the specifics, think it may have been one of the support libraries.. I do remember it was a pain to track down and I had to override alot of the base methods because of it.. it scared me off of ever using this technique in commercial code..
@CerealLover566 жыл бұрын
Have you never looked at the source code for the java.util packages? The collections defined in that package are going to be used in pretty much every Java application on the planet. They're full of bit operations. They're a fast and efficient way of doing a lot of basic mathematics that would otherwise cause unnecessary slowdown.
@KingOfAceZ15 жыл бұрын
embedded systems? you know, electronics that you can't just download a magical sdk for? you're standing on the shoulders of giants, lol.
@OhsoLosoo2 жыл бұрын
@@KingOfAceZ1 alot of CompSci students today don't understand that the stuff they use is built on these very operations that they think no longer serve any practical purpose.
@ipodtouch470 Жыл бұрын
@@KingOfAceZ1 I programmed a digital lock in assembly using an 8bit pic microcontroller and you are correct we are indeed standing on the shoulders of giants. The people that are the most guilty are probably web devs, they seem like they have a package for everything...
@MuhZubairAli6 жыл бұрын
In binary there is no 2, as being explained 1:38 instead it's 1+1=10 (from this result 0 is placed while 1 is carried to next calculation...
@jackmocherman12966 жыл бұрын
Right, which is why she carries it. Same as in decimal where there is not single symbol for 10. We still describe the condition for carrying a number as two digits in the same place adding up to 10 or more even though there is no "10" symbol, or what is represented as "A" in hexadecimal.
@FernandoBasso4 жыл бұрын
The Hackerrank link doesn't work any longer.
@phil_ka2 жыл бұрын
that -18 from 18 was damn cool
@mehdibouchene32082 жыл бұрын
how the hell is 8 bit used does the computer have the right to only use 8 at one time or how?
@geraldinejns6 жыл бұрын
greate video, but where did you get the numbers 637 and 011.
@anonymousExposure5 жыл бұрын
It's a random number that she uses for the purpose of just showing how to add them. So she could have used any other numbers, I got confused by it at first as well.
6 жыл бұрын
hope some one help me with my question minute 2:45, i completely understand how we inverse the number, but why arbitrary 10 00 00 00(128)? from e where does it come that?
@serkandemirel50754 жыл бұрын
For example after +127 (01111111) we get -(0) which is 1000000. Although that zero is basically 128 as unsigned 8-bit number, it becomes the first zero before we get to the first negative number, -127 (10000001).
@proggenius20242 жыл бұрын
Great content with good explanation. Thank you👍
@crackcodinginterview49954 жыл бұрын
Good way to explain bits!
@vamseekotha3 жыл бұрын
i like the way she says hi
@MadForCs164 жыл бұрын
m a bit overwhelmed after seeing this video
@muhammadroohallah60913 жыл бұрын
Than. You random lady U just explained in a few seconds what my teacher couldn’t over the course of a few lectures (maybe that’s cause i wasn’t listening 🌚)
@Saykey201113 жыл бұрын
1 minute into the video do you know where she got 637? Thanks a lot if you can explain.
@moj83013 жыл бұрын
@@Saykey20111 She was just showing you how to add up numbers
@jibreelkeddo70305 жыл бұрын
Good video but wish it spent more time explaining why we use two's compliment vs one's compliment and the difference. I got stuck on that for a little bit.
@skilz80984 жыл бұрын
The simplest reason that 2's complement is preferred over 1's complement is that with 1's complement you end up with two zeros, a + and a - zero which can lead to ambiguity within the hardware-software implementation of the adders. Also, 2's complement has the effect that when you add any two signed numbers you will get the correct result for both positives and negatives whereas with 1's complement in some situations the result will be off by 1 due to the two zeros that are produced by 1's complement.
@vikashh3846 жыл бұрын
Nice Short and Clear.
@mohamedfouad23047 жыл бұрын
What are the books on the table???
@onionsandwich3 ай бұрын
Masterclass !
@jarrodburns63392 жыл бұрын
Excellent video, thank you.
@Tea-Spin6 жыл бұрын
How do you tell the difference between -123 and 133?
@APaleDot6 жыл бұрын
This is where the distinction between singed and unsigned integers comes in. If the data-type we're talking about is an unsigned 8-bit integer, then 10000101 is 133. If it's a signed 8-bit integer, then 10000101 is -123. Unsigned 8-bit integers can be in the range 0 to 255. Signed 8-bit integers are in the range -128 to 127. Both can hold 256 different values, but the signed ones are centered around zero.
@sebastiangudino93774 жыл бұрын
I'm late, but i want to add that the point of representing signed numbers this way, is that we can use the same adition operation on both signed and unsigned types and still get the correct result. So we can use the same adition circuit to add signed and unsigned integers, we can also implement subtraction by adding A + (-B) and that also works for signed and unsigned numbers, it's a really convenient and powerfull practice
@johnjonjhonjonathanjohnson35596 жыл бұрын
what if a 1 sexually identifies as a 0
@RickeyBowers5 жыл бұрын
life gets a bit complicated
@morguhnburke6855 жыл бұрын
cant even miss gender numbers anymore can we
@ShubhamSingh-wm1gh7 жыл бұрын
one of the best video I've ever seen .. really appreciate your work big thumbs up 👍
@rajasanchit4 жыл бұрын
i am forgetting how 11110100 = -12, Can someone explain this?
@cookergronkberg4 жыл бұрын
since the left-most bit is 1, you know it is a negative number. To find the value, first take the complement (invert all bits): 00001011, then add 1 Result: 00001100 (12 in binary)
@ohdude66434 жыл бұрын
That "manipulation" square wave got me distracted.
@emilyhuang27594 жыл бұрын
How is logical 0111 0100 = 116 and arithmetic 1111 0100 = -12 ? @6:32
@protojem4 жыл бұрын
because, when a number has a 1 in the first bit it indicates a negative number, and a negative number representation is the opposite of the original number, as we saw at 2:15
@skilz80984 жыл бұрын
@@protojem Only when the register type is a signed type! If it's unsigned then there is no negative bit!
@halo3gamer157 жыл бұрын
wait, what did i miss ? Binär: 101 isn´t 583 ?!
@iloveanime92267 жыл бұрын
101 is 1x2^2+0x2^1+1x2^0 = 5 It just like how 105 = 1×10^2+0×10^1+5×10^0 But in binary you have 2 possible number (0 & 1) while in decimal you have 10 possible numbers (0 to 9) and the power is just the index of the number starting at 0 from the right side incrementing as you move to the left so in binary 0 = 0x2^0 = 0 in decimal 1 = 1×2^0 = 1 in d 10 = 1×2^1+0×2^0 = 2 in d 11 = 1×2^1+1×2^1=3 in d 100 = 1×2^2+0×2^1+0×2^0 = 4 in decimal Anything multiplied by 0 is 0 so we can skip that So 100 = 2^2 = 4 583 = 2^9+2^6+2^2+2^1+2^0 So these will be ones and everything in between will be zeros so 583 = 1001000111
@I_GearV94 жыл бұрын
at 0:57 where is Gayle getting 637 from?
@serkandemirel50754 жыл бұрын
It's just a random number that she used to demonstrate how we do addition in base 10.
@AmirHamedZakeri4 жыл бұрын
thanks very good explanation
@techfornoobs42416 жыл бұрын
do i really need to know this for tech internships?
@ITech20055 жыл бұрын
Daniel Ro Yes
@phamanghung23185 жыл бұрын
I will fail the interview if asked bitwise operations now lol
@pwn0x805 жыл бұрын
Me to
@depshallburn5 жыл бұрын
They don't even teach this shit in my college.
@huey11535 жыл бұрын
Dx D You don’t take discrete math or low level systems?
@ba1anse5 жыл бұрын
good video but it is so densely packed, it is not good for beginner to learn at such rapid pace.
@chefdeprestigellc88554 жыл бұрын
Its quick, reduce payback speed
@plunk67742 жыл бұрын
Огромное спасибо за столь хорошее объяснение материала!
@bhagyasrividyathota67104 жыл бұрын
Ma'am please explain how to use constraints in bit manipulation and also with time complexity and space complexity please
@chiting7655 жыл бұрын
A little confused at the masks
@juanhernandez-up4pg5 жыл бұрын
A bit confused
@weho_brian3 жыл бұрын
Gail is a fantastic teacher!
@sackratte247 жыл бұрын
great quality
@sagunpandit63143 жыл бұрын
this is really good.
@crapadopalese7 жыл бұрын
Sounds like Rebecca Black is narrating this.
@wkal14433 жыл бұрын
Now my left ear knows about bit manipulation
@FilipMakaroni_xD2 жыл бұрын
Oh lord, I've been doing this to "clear a bit" in one of my programs x &= (0