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
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Generate all binary strings of length n with sub-string "01" appearing exactly twice
- 0/1 Knapsack using Branch and Bound
- Job Assignment Problem using Branch And Bound
- N Queen Problem using Branch And Bound
- 8 puzzle Problem using Branch And Bound
- Implementation of 0/1 Knapsack 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 the binary strings of N bits
- Generate all binary strings without consecutive 1's
- 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 of Binary strings of length N having atmost M consecutive 1s or 0s alternatively exactly K times
- 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 with even set bit count and at most K consecutive 1s
- Count of same length Strings that exists lexicographically in between two given Strings
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.