The task is to generate a binary string of length N using branch and bound technique
Input: N = 3
Numbers with 3 binary digits are
0, 1, 2, 3, 4, 5, 6, 7
Input: N = 2
Generate Combinations using Branch and Bound :
- It starts with an empty solution vector.
- While Queue is not empty remove partial vector from queue.
- If it is a final vector print the combination else,
- For the next component of partial vector create k child vectors by fixing all possible states for the next component insert vectors into the queue.
Below is the implementation of the above approach
000 001 010 011 100 101 110 111
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Generate all binary strings of length n with sub-string "01" appearing exactly twice
- 0/1 Knapsack using Branch and Bound
- 8 puzzle Problem using Branch And Bound
- Implementation of 0/1 Knapsack using Branch and Bound
- N Queen Problem using Branch And Bound
- Job Assignment Problem using Branch And Bound
- 0/1 Knapsack using Least Count Branch and Bound
- Difference between Backtracking and Branch-N-Bound technique
- Traveling Salesman Problem using Branch And Bound
- Generate all binary strings from given pattern
- Generate all binary strings without consecutive 1's
- Generate all the binary strings of N bits
- Count of binary strings of given length consisting of at least one 1
- Number of binary strings such that there is no substring of length ≥ 3
- Find the number of binary strings of length N with at least 3 consecutive 1s
- Number of Binary Strings of length N with K adjacent Set Bits
- Count number of binary strings such that there is no substring of length greater than or equal to 3 with all 1's
- Count of Binary strings of length N having atmost M consecutive 1s or 0s alternatively exactly K times
- Count of binary strings of length N having equal count of 0's and 1's
- Count of binary strings of length N with even set bit count and at most K consecutive 1s
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.