General Discussions

Multiples of 8

To check if the number is multiple of 8, the bitwise way is that: first right shift by 3 and then left shift by 3. Multiple of 8 will remain the same as original number after this operation. Examples: 8:        1000 >> 3 :  0001 <<3  :  1000 24:      11000… Continue reading Multiples of 8

General Discussions

Union-Find Data Structure: Intro

Originally posted on PH Bytes:
A disjoint-set data structure, also called a union–find data structure keeps track of a set of elements partitioned into a number of disjoint (non-overlapping) subsets. With this setting we define the following operations: Find: Determine which subset a particular element is in. This can be used for determining if two…