help about bitmask

Revision en1, by Harolinch, 2018-08-21 15:48:29

i'm trying to solve a dp problem involves bitmasks and when i see others code, all of them have the these lines

for(mask = 0; mask < (1 << k); mask++){
    ..
    for(submask = (mask - 1) & mask; submask > 0; submask = (submask - 1) & mask){
        ..
    }

what these lines means ?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Harolinch 2018-08-21 15:48:29 331 Initial revision (published)