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.
- 0/1 Knapsack using Branch and Bound
- Implementation of 0/1 Knapsack using Branch and Bound
- 8 puzzle Problem using Branch And Bound
- N Queen Problem using Branch And Bound
- Job Assignment Problem using Branch And Bound
- Traveling Salesman Problem using Branch And Bound
- 0/1 Knapsack using Least Count Branch and Bound
- Difference between Backtracking and Branch-N-Bound technique
- Generate all binary strings of length n with sub-string "01" appearing exactly twice
- Generate all binary strings from given pattern
- Generate all binary strings without consecutive 1's
- Generate all the binary strings of N bits
- Branch Prediction in Pentium
- Lower and Upper Bound Theory
- Bound, unbound, and static methods in Python
- Count of binary strings of length N having equal count of 0's and 1's and count of 1's ≥ count of 0's in each prefix substring
- Count of same length Strings that exists lexicographically in between two given Strings
- Check whether two strings can be made equal by reversing substring of equal length from both strings
- Print all strings of maximum length from an array of strings
- 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 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.