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
- 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
- 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
- Number of Binary Strings of length N with K adjacent Set Bits
- Find the number of binary strings of length N with at least 3 consecutive 1s
- Count number of binary strings such that there is no substring of length greater than or equal to 3 with all 1's
- Generate all possible strings such that char at index i is either str1[i] or str2[i]
- Generate two output strings depending upon occurrence of character in input string.
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.
Improved By : Rajput-Ji