To represent each no. by 1 bit, for 5000 nos , we require 5000 bits.
Since an integer has 32 bits. A set can be represented by an 156 integr
array.In array each bit corresponding to no. in set is set.  Thus is
set1 contains no. k. Let i=k/32, pos=k%32. Then for set1, pos LSB of
ith element of array is set to 1. Similarly bit corresponding to each
element of set1 is set. Thus using this method, using one & operation
in each set, we can check if no exists in set.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to