0% found this document useful (0 votes)
65 views2 pages

Ezehdominic CS 3304 Analysis of Algorithms Unit 1

Brute force algorithms exhaustively check all possible solutions to a problem to find the optimal solution, which can be very inefficient. Branch and bound algorithms are more efficient by pruning the search space by eliminating partial solutions that cannot lead to the optimal solution. Both algorithms are discussed and compared using the traveling salesman problem and 0/1 knapsack problem as examples. Brute force algorithms have exponential time complexity in the worst case, while branch and bound algorithms can solve some problems more efficiently by pruning non-promising solutions.

Uploaded by

Dominic Ezeh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views2 pages

Ezehdominic CS 3304 Analysis of Algorithms Unit 1

Brute force algorithms exhaustively check all possible solutions to a problem to find the optimal solution, which can be very inefficient. Branch and bound algorithms are more efficient by pruning the search space by eliminating partial solutions that cannot lead to the optimal solution. Both algorithms are discussed and compared using the traveling salesman problem and 0/1 knapsack problem as examples. Brute force algorithms have exponential time complexity in the worst case, while branch and bound algorithms can solve some problems more efficiently by pruning non-promising solutions.

Uploaded by

Dominic Ezeh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Ezehdominic CS 3304 Analysis of Algorithms Unit 1, Term 2 Discussion Forum Question: In

your own words describe both brute force algorithms and branch and bound algorithms and
identify the differences between the two. As part of your description, you must discuss the
Asymptotic behavior of each and discuss why this is important and how this might factor into the
decision to use either algorithm design. (Uopeople CS AY2023-T2).
My Answer Submission
Brute force algorithms: means consistent trial, that is going through all possible means or
repeatable solution extensively to achieve an aim; For example, hackers apply many password or
encryption keys go through all possible combination of moves trying to find a perfect match to
login into web page or site to defraud, we called it brute force attack. ( GeeksforGeeks 2022)
Branch and bound algorithm is a systematic methodological concept set out for solving combinatorial
optimization problems such as algorithm problem which uses combinatorial techniques “Alphabets,
strings, and languages” for analysis and design, that is “to compute a function f: Σ∗ → Σ∗ over strings of a
finite alphabet” in a mathematical programming criteria (Lecture 2: Strings, Languages, DFAs 2008)
(10.1.1 What is an algorithmic problem)

Practically, Branch and bound is usually an optimization technique used when finding an optimal solution
for combinatory mathematical optimization problems in a situation where greedy method and dynamic
programming fail. (Branch and Bound Algorithm: Baeldung 2022) (Greedy Algorithm – Programiz n.d)

Meanwhile, the circumstances surrounding branch and bound is always slower which leads to
exponential time complexities in a worst case but if carefully applied it can also lead to algorithm run fast
in an average case but in analysis more emphasis are laid on worst case because average are rare

A perfect example, or concept of branch and bound is like “Breadth-First Search (BFS)” they both involve
backtracking except the different of performing a breadth-first search instead of depth-first search which
we can see in 0-1 Knapsack Problem where we see that items are either completely or no items are filled
in a knapsack, searching for optimal solution we know that not all nodes generate children or expand, so
carefully selected criterion determines which node or element to expand and when, breadth-first search
removed nonpromising branches by the process of backtracking algorithm rules and in algorithm search
breadth-first search uses queue but queue replace with stack implement depth-first search. (Clifford,
2010) (GeeksForGeeks 2022) (Branch and bound strategy Ques10 n.d)

Comparison of brute force algorithm and branch and bound algorithm.

Comparisons in them can be seeing in their implementation using “Traveling Salesman Problem (TSP) as
an example: According to “TechTarget explanation, ‘TSP is an algorithmic problem tasked with finding
the shortest route between a set of points and locations that must be visited, ‘following TSP method,
brute-force algorithm check every possible paths in a larger time consuming while branch-and-bound
algorithm start from 0 which is the optimal path, and filter out all other paths that start by alternating
between the nodes on the left and the nodes on the right more than once in a lesser time consuming.
(TSP WhatIs.com)
In solving 0/1 knapsack problem as I mentioned above, we see differences between brute force
algorithm and branch and bound algorithm, four values are provided in array format to solve 0/1
Knapsack problem using brute force and branch and bound algorithm: -

1. N = Number of items.
2. V[] = Value of each item equally know as vector.
3. Wt[] = Weight of every item.
4. W = capacity of knapsack

Here, we are required to find subset larger value of v[] to determine that weights sum of items are less
than capacity of knapsack or W, then for brute force algorithm, with n items, O(2^n) and Ω(2^n)
solutions will be generated because it has no form of optimization. (GeeksforGeeks, 2022)

Branch and bound work better than the less going by 0/1 knapsack problem, assume bound is known,
node can be ignored with its subtree that is worse than current best or bound and carry on with our best
scenario of calculating one path of the tree Ω(n). But, in worst case, we need to fully calculate entire tree
O(2^n) as I stated earlier. (GeeksforGeeks, 2022)

Reference:
1. Branch and Bound Algorithm – GeeksforGeeks 2022 Retrieved from
https://www.geeksforgeeks.org › branch-and-bound-alg
2. Lecture 2: Strings, Languages, DFAs 2008 Retrieved from https://courses.engr.illinois.edu ›
lectures › lect_02
3. 10.1.1 What is an algorithmic problem? (n.d) Retrieved from https://courses.engr.illinois.edu ›
lec_prerec
4. Branch and Bound Algorithm | Baeldung on Computer Science 2022 Retrieved from
https://www.baeldung.com › branch-and-bound
5. Greedy Algorithm – Programiz (n.d) Retrieved from https://www.programiz.com › dsa › greedy-
algorithm
6. Dynamic Programming vs Branch and Bound – CodeCrucks 2022 Retrieved from
https://codecrucks.com › dynamic-programming-vs-bra
7. Breadth First Search or BFS for a Graph – GeeksforGeeks 2022 Retrieved from
https://www.geeksforgeeks.org › breadth-first-search-or
8. DAA | 0/1 Knapsack Problem – Javatpoint (n.d) Retrieved from https://www.javatpoint.com › 0-
1-knapsack-problem.

You might also like