in the given video ,why we have done bitset of arrays and how it will help to check prime or not?
Large prime check using sieve
Hello @lovely the basic difference is that bitset only stores the bit i.e 0 and 1.
but in the array the size if even int is 4 bytes and the size you will give to it suppose is n the total memory it will take is 4*n which is unnecessary.
so you can optimise it by making bitset.
bitset only take the bit size.
if you still have any doubt you can ask here:
Happy Learning!!
can u explain me with an example as i am not able to understand use of bit to check prime.
Hello @lovely if you know about the prime sieve then in it we only mark the numbers as 0 and1 in which 0 means that it is not prime and 1 means that it is prime.
so thats why we have come up with the approach to not to take large memory when we only have to store bitsi.e 0 and 1.
have you seen the prateek bhaiya video on this?
if you still have any doubt you can ask here:
Happy Learning!!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.