DAA Solution
DAA Solution
The step by step procedure to solve the given problem is known as algorithm. (1m)
*Finiteness
*Definiteness - (1m)
*Input
*Effectiveness
* Versatility or Flexibility
Brute Force Method is a straight forward approach to solving a problem, usually directly based on the problem
statement and definitions of the concepts involved. It involves trying all possible solutions to a problem until the correct
one is found. – (2m)
Topological sorting is a way to order the vertices in a DAG such that if there is an edge from vertex A to vertex B,
then A comes before B in the ordering. This is useful for determining the project or the order in which events
occurred in a timeline. – (1m)
Example
:
A
G C
E
B
D
- (1m)
5. What is minimum cost spanning tree of a graph? Give example.
In a weighted graph G = (V, E), the weight W of a subgraph is the sum of the weights of the edges in the subgraph. A
minimum spanning tree for a weighted graph is a spanning tree with minimum weight. – (1m)
Example:
A connected graph G which n=4 is as shown below
- (1m)
The spanning trees with the costs are as follows.
Class P is a class of decision problems that can be solved in polynomial time by algorithm. This class of problems
is called polynomial. - (1m)
Class NP is the class of decision problem that can be solved by non-deterministic polynomial algorithm.
This class of problem is called as non-deterministic polynomial. - (1m)
SECTION - B
Answer any four questions. Each question carries five marks. (4x5=20)
Mathematical analysis of algorithms involves using mathematical tools and techniques to determine the efficiency of
an algorithm in terms of its time and space complexity. This type of analysis is theoretical nature, as it doesn't involve
actually running the algorithm, It predicts the algorithm performance based on the algorithm's structure and operations.
The efficiency of an algorithm is typically expressed using Big O notation, which provides an upper bound on the time
or space complexity in the worst-case scenario. - (2m)
Example: Consider a simple algorithm for finding the maximum element in an unsorted array:
FindMax (A, n)
max = A[0]
for i =1 To n - 1 DO
max = A[i]
END FOR
In this algorithm, 'A' is an array of 'n' elements. The basic operation here is the comparison A[i] > max. This operation
occurs ‘n - 1' times (once for each element in the array after the first one).
Therefore, we can say that the time complexity of the algorithm is O(n) because the number of operations grows
linearly with the size of the input. That is, if we double the size of the array, we approximately double the number of
operations.
The space complexity of this algorithm is O(1) which signifies constant space. Regardless of the size of the input array,
we only use a fixed amount of additional space (to store the variable 'max' and the loop counter '1').
This is a simple example, but the process can get more complex when analysing more complex algorithms.
Mathematical analysis of algorithms is a fundamental skill in computer science, because it allows us to predict and
compare the efficiency of different algorithms without having to implement or extensively test them.
8. Write an algorithm to sort the array using bubble sort and obtain its time complexity.
Bubblesort ( A [0,.....,n-1])
temp = a[j]
a[j] = a[j + 1]
a[j + 1] = temp
We are running two loops, an outer loop which runs n - 1 times (pass = 1 to n - 1) , and an inner loop which iterates
over the unsorted part of the array G = 0 to n-pass-1). This ensures that after each pass, the largest element is bubbled
to the end of the array.
: . As the value of pass is varying from 1 to (n - 1) the value of comparisons from (n - 1) to 1 respectively.
* The if condition inside the inner loop is checking if the current element (a[j]) is greater than the next element
* After n - 1 passes, all elements would have bubbled up to their correct positions, resulting in a sorted array.
Breadth-First Search (BFS) is a fundamental graph traversal algorithm used in computer science and mathematics
to explore all nodes of a graph or tree data structure. The strategy of BFS is to explore the graph "broadly" before
going "deep". That is, it visits all the nodes at the current level before moving on to the next level. – (2m)
The BFS algorithm starts at an arbitrary root node, then explores all the neighbour nodes at the present depth level,
and then moves on to nodes at the next depth level. It does this by using a queue data structure to keep track of nodes
to be visited. Nodes are visited and dequeued (removed), then all unvisited neighbours of the current node are
enqueue(inserted) and marked as visited.
- (3m)
The term "breadth" in BFS refers to the breadth, or width, of the tree or graph. BFS explores all the neighbour nodes
at the current level before proceeding to nodes at the next level. refers to the process of visiting and examining each
node. In contrast, "search" refers to the process of visiting and examining each node.
For instance, imagine a family tree where BFS starts at the root of the tree (the oldest known ancestor). It first visits all
the children (level one descendants), then all the grandchildren (level two descendants), and so forth, until all
descendants at each level are visited. In other words, BFS visits nodes in a way that fills up each level of the family
tree from left to right before descending to the next level.
Example 1: BFS
2 3
4 5 6
In this example, starting from node 1 (considered as the root), BFS first visits all the neighbours of node 1. which are
nodes 2 and 3. It then visits the neighbours of node 2 and node 3. So, it first visits nodes 4 and 5 which are the children
of node 2, and then it visits node 6 which is the child of node 3. Therefore, BFS fills up each level of the tree from left
to right before moving down to the next level.
8C5 = 8!
(5!( 8-5)!)
8C5 = 8 x 7 x 6 x 5!
5! X 3!
8C5 = 8 x 7
8C5 = 56
10.Apply Prim's algorithm to obtain the minimum cost spanning tree for the following graph.
Solution:
Cost adjacency matrix is
C A B c d e f
A - 3 ∞ ∞ 6 5
B 3 - 1 ∞ ∞ 4
C ∞ 1 - 6 ∞ 4
D ∞ ∞ 6 - 8 5
E 6 ∞ ∞ 8 - 2
F 5 4 4 5 2 -
- (3m)
Minimum spanning tree is :
1 2 3 4
1
queen1
2
queen2
3
queen3
4
queen4
Step 1: In the following steps we use x1 = 1 indicates that first queen placing in first column, x 1= 2 indicates that first
queen placing in second column and so on. Similarly, x2= 1 indicates that second queen placing in first column, x 2= 2
indicates that second queen placing in second column and so on.
Step 2: We start with placing queen 1 in first column. i.e., we choose x1 = 1
1 2 3 4 Each step 1m
1 Q1
All steps 5m
2
Step 3: Now we move to place queen 2. Place Q2 in first column and second row and which is not acceptable
position because- Q1 attacks Q2 since they are on the same column. (We have chosen x2 = 1 )
1 2 3 4
1 Q1
2 Q2
Step 4: Now place Q2 in second column i.e., choose x2 = 2 which is also not an acceptable position since Q1 and Q2
are diagonally opposite to each other.
1 2 3 4
1 Q1
2 Q2
1 2 3 4
1 Q1
2 Q2
Step 6: The Q1 and Q2 are successfully placed and now we move to place Q3. Placing Q3 in first column (x3 = 1) is
not acceptable because Q1 and Q3 can not be in the same column.
1 2 3 4
1 Q1
2 Q2
3 Q3
4
Placing Q3 in second column ( x3 =2) is also not allowed since it is diagonally opposite to Q 2. Placing Q3 in third
column (x3 = 3 ) is also not allowed because Q2 and Q3 lies on the same column. Placing Q3 in fourth column is also
not acceptable ( x3=4) because it is diagonally opposite to Q2. So we can not place Q3 in any of the columns.
Step 7: Now the algorithm backtracks and puts Q2 in the fourth column as shown below.
1 2 3 4
1 Q1
2 Q2
4
We have placed Q2 in fourth column which is an acceptable position. Now placing Q 3 in first column (x3 = 1) is not
acceptable because Q1 and Q3 lies on the same column. Placing Q3 in second column (x3 = 2) is perfectly
acceptable. Therefore, put Q3 in second column i.e., in position (3, 2).
1 2 3 4
1 Q1
2 Q2
3 Q3
Step 8: Since all the first three queens are placed in perfect positions now, we are required to place the fourth queen.
Placing Q4 in first column (x4= 1) is not acceptable, placing Q4 in second column (x4 = 2) is also not acceptable,
placing Q4 in third column (x4 = 3) is also not acceptable and placing Q4 in fourth column (x4 = 4) is also not allowed.
Therefore, we cannot place Q4 in any of the columns.
1 2 3 4
1 Q1
2 Q2
3 Q3
4
Q4
Now we backtrack to row 3 and place Q3 in third column which is not acceptable position and place Q 3 in fourth
column which is also not acceptable position. Again, backtrack to row 2, in row 2 we have tried all the positions.
Therefore backtrack to row 1 and place Q1 in second column (x1 = 2) as shown below.
1 2 3 4
1 Q1
Step 9: Placing Q2 in first column (x2= 1) is not allowed because it becomes diagonally opposite to Q 1. Placing Q2 in
second column ( x2 =2) is also not allowed because Q1 and Q2 lies on the same column. Placing Q2 in third column
(x2= 3) is also not acceptable because it becomes diagonally opposite to Q1.
Placing Q2 in fourth column is perfectly acceptable. Therefore put Q2 in fourth column (x2 = 4).
1 2 3 4
1 Q1
2 Q2
Step 10: Now we will start placing Q3 in third row. Placing Q3 in first column (x3= 1) is perfectly acceptable. Therefore
put Q3 in first column (x3= 1).
1 2 3 4
1 Q1
2 Q2
Step 11: Now we will place Q4 in fourth row. Placing Q4 in first column (x4= 1) is not acceptable because Q3 and Q4
lies on the same column. Placing Q4 in second column (x4 = 2) is also not acceptable because Q3 and Q4 becomes
diagonally opposite. Placing Q4 in third column (x4 = 3) is perfectly acceptable. Therefore put Q4 in third column of
fourth row as shown below.
1 2 3 4
1 Q1
2 Q2
SECTION – C
Answer any four questions. Each question carries eight marks. (4x8=32)
It gives the upper bounds of the algorithm running time or growth rate of functions
The f(n) and g(n) are the functions that is f(n) €O(g(n)) and c and n0 are satisfying constraints and positive
constraints that is f(n) ≤ c *g(n) for all n ≥ n0
-(2m)
→ Big Omega Notation:
It is a measure of least amount of time for the possibility to complete execution of an algorithm.
It gives the lower bounds of the algorithm running time or growth rate of functions
The f(n) and g(n) are the functions that is f(n) €Ω(g(n)) and c and n0 are satisfying constraints and positive
constraints that is f(n) ≥ c *g(n) for all n ≥ n0
-(2m)
-→ Big Theta Notation:
The function f(n) is said to be in ∂(g(n)) denoted by f(n)€ ∂(g(n))
The f(n) is bounded both above and below by some positive constraint multiples of g(n) for all large value of n
That positive constraints such as c1 and c2 and non-negative integer n0 such that
C1*g(n) ≤ f(n) ≤ C2*g(n) for all n ≥ n0
-(2m)
14.a) Discuss important problem types.
Problem Types:
Design and analysis of algorithms is not restricted to specific problem types. The steps to solve a problem can be
applied to any problem regardless of its complexity or whether it is in the computer field or another field.
2.Searching Problems: Searching refers to finding for an item in any list of entries. It is one of the common
operation in data processing. Searching an employee details from the database or searching a telephone number
from the telephone directory are few of the daily life instances.
3.String Processing Problems: Strings are sequences of characters and String processing problems involve
manipulating strings to perform various operations such as searching, matching, and editing. There are many kinds
of strings like text made up of letters and numbers or even sequences of DNA which have four different "letters": A,
C, G, and T. String processing is a big part of computer science, and it's used in all sorts of fields, from creating
computer software to understanding DNA sequences in biology.
4. Combinatorial Problems:
Combinatorial problems are a type of problem in computer science and mathematics that involve counting or
generating combinations or permutations of objects. These problems often arise in various fields, including computer
science, statistics, and engineering. Combinatorial problems can be broadly classified into two categories:
enumeration problems and optimization problems.
5.Graph Problems:
Graph problems involve analyzing and manipulating graphs, which are mathematical structures consisting of nodes
(also called vertices) connected by edges. Graphs can be used to model a wide range of real-world systems
including social networks, transportation networks, and computer networks.
6. Geometric Problems:
Geometric problems involve analyzing and manipulating geometric objects such as points, lines, and polygons.
These problems can arise in a wide range of applications such as computer graphics, robotics, and tomography.
1. Convex Hull Problem: Given a set of points in the plane, find the smallest convex polygon that contains all the
points. This problem is commonly used in computer graphics to render 3D objects.
2.Nearest Neighbour Problem: Given a set of points in the plane, find the closest point to a given query point. This
problem is commonly used in location-based services to find nearby places or people.
7. Numerical Problem:
Numerical problems involve computations with numbers. This could include tasks like finding roots of equations,
performing matrix operations, or solving differential equations. Various numerical methods and algorithms are used
to solve these types of problems. The majority of these problems can be solved only approximately. But these
problems play a vital role in many scientific and engineering applications. So the algorithms for this type of problems
should be more sophisticated and more focus is required while designing these algorithms.
Examples of Numerical Problems:
*Finding Roots of Equations
* Performing Matrix Operations,
* Solving Differential Equations
1.Execution Time: It's the actual time taken by the algorithm to run from start to finish on a particular computing
system.
2. Memory Usage: It's the amount of computer memory (RAM) the algorithm uses during execution.
3.CPU Usage: It refers to the amount of computing resources used by the algorithm, which is especially important in
multitasking systems.
4. I/0 Operations: In case the algorithm involves reading from or writing to files or databases, the number and
efficiency of these operations are also considered.
- (2m)
It's important to note that empirical analysis requires the algorithm to be implemented in code, which means that the
characteristics of the programming language, the efficiency of the code, and the specific hardware and software
environment in which the program is run will all impact the results. Hence, the empirical analysis provides a practical
view of an algorithm's efficiency, but it's dependent on the specific implementation and the computational
environment.
2. Machine Dependent: The results obtained from empirical analysis are usually specific to the machine (hardware
and software environment) on which the tests are performed. This means results may not be representative of how
the algorithm will perform on different hardware or under different operating systems.
3. Input Data Dependent: Empirical analysis depends on the test data used. If the test data is not representative of
the actual inputs the algorithm will encounter, then the analysis may not provide a true reflection of its real-world
performance. This includes both the size and nature of the data.
For example, we might want to find all occurrences of the word "pub" in a "skyward publishers". In this case, "pub" is
the pattern, and the "skyward publishers" is the text. String matching algorithms scan the text to find positions where
the pattern and the text align exactly.
Example
1. Text="Problem Solving Techniques"
Pattern =Problem
Pattern Found at 1st position
Occurrences of Pattern = 1 Time
-(2m)
2. Text : A A B A A C A A D A A B A A B A
Pattern: A A B A
Pattern Found at 1st , 10th and 13th positions
Occurrences of Pattern = 3 Times
end for
if j == patLen then
The pattern found at the position i+1
return (i + 1)
end if
end for
* This algorithm operates by conducting an iterative comparison of each character in the pattern to each
corresponding character in the text.
*The variables - i, and i are declared and set to zero. These variables will be used to keep track of the positions in
the text and pattern during comparison (i and j),
* The outer loop runs from 0 to the difference of the lengths of the text and the pattern (n - m) This ensures that every
position in the text where the pattern could possibly fit is checked. The inner loop then compares each character in
the pattern with the corresponding character in the text at the current position.
*If at any point, a pair of characters are found that do not match, the inner loop is terminated, and control goes back
to the outer loop to proceed with the next position in the text. Conversely, if a complete pattern match is found (i.e.,
the inner loop completes without finding any mismatches), the position of the pattern match in the text is returned.
*After the outer loop has completed, indicating that every possible starting position in the text has been checked for
the pattern and pattern is not found. It return -1.
- (2m)
b) Explain how decrease and conquer method is applied to sort the elements of the array using insertion sort.
(4+4)
Decrease and Conquer: The Decrease and Conquer method is a problem-solving technique that involves breaking
down a problem into smaller subproblems, solving each subproblem independently, and then combining the
solutions to the subproblems to solve the original problem.
The name "decrease and conquer" comes from the fact that this technique involves reducing the size of the problem
at each step until it becomes small enough to solve directly.
The decrease and conquer method is often used in computer science and mathematics to solve complex problems
efficiently. By breaking down a large problem into smaller sub-problems, it becomes easier to manage and solve
each part independently. This can lead to faster computation times and more efficient use of resources.
The Insertion sorts inserts each element in appropriate position. This is same as playing cards, in which we insert a
card in proper position. If an array A contains n elements and we place each element of an array at proper place in
the previously sorted element list.
-(2m)
The first pass starts with comparison of 1st element with 0th element. i.e., A[1] with A[0] .In the second pass 2nd
element is compared with 0th and 1st element, i.e. ,A[2] with A[0] and A[1]. In general, in every pass an element is
compared with all elements before it.
Let us take an array A of N elements. The process of inserting each element in proper place is as shown below:
Pass 0: A[0] is already sorted because of only one element.
Pass 1: A[1] is inserted before or after Lambda[0] So A[0] and A[1] are sorted.
Pass 2: A[2] is inserted before A[0] or after A[1] or in between A[0] and A[1]. So A[0], A[1] and A[2] are sorted.
Pass 3: A[3] is inserted into its proper place in A[0] , A[1] , A[2]
So A [0] , A[1], A[2] and A[3] are sorted.
……………………………………………………..
……………………………………………………..
………………………………………………………
Pass N - 1 : A[N - 1] is inserted into its proper place in A[0],A[1]....... A[N - 2] So A[0], A[1], A[2] ........... A[N - 1] are
sorted.
Any element to be inserted in between the ith element and i+ 1th element is possible only when element >=ith element
and element < = (i + 1)th element.
- (2m)
16.Explain different tree traversal algorithm with example.
Graph Traversals:
Graph traversal is the process of visiting all the vertices and edges of a graph in a systematic way. It involves
exploring the graph from a starting vertex and visiting all its neighbours, then moving to their neighbours, and so on
until all vertices have been visited. It's like visiting each room in a house, where the rooms are the vertices and the
doors between them are the edges.
The term "exhaustive search"can also be applied to two very important algorithms that systematically process all
vertices and edges of a graph. These two graph traversal algorithms are Depth-First The term Search (DFS) and
Breadth-First Search (BFS). These algorithms have proved to be very useful for many applications involving graphs
in artificial intelligence and operations research. Graph traversal algorithms are used to solve various problems such
as finding connected components, detecting cycles, computing shortest paths etc.,
Depth First Search (DFS):
Depth-First Search (DFS) is a graph traversal technique used in computer science and mathematics to explore all
the vertices of a graph or tree data structure. The process is called "Depth-First" because it is used to search deeper
into the graph whenever possible and only backtracks to a previous node when it has fully explored a branch.
The algorithm starts at an arbitrary node and visits all its neighbours, then moves to the next unvisited neighbour
and repeats the process until no more unvisited neighbours are found. Then it backtracks to the previous node and
continues exploring its unvisited neighbours until all nodes have been visited.
The "depth" in DFS refers to how far a path has been explored from the root node, while the "search" refers to the
process of visiting and exploring each node. In other words, DFS is like navigating a maze by always choosing an
unexplored path and only turning back when reaching a dead-end.
For example, in a family tree, DFS would start at the root (the oldest ancestor), and first explore the first child and
their descendants as far as it can before moving to the second child and their descendants.
DFS is a powerful algorithm for solving problems related to graph and tree structures, including detecting cycles,
path finding, and topological sorting
Example 1:
Let's take an example of a tree graph:
4m
2 3
5
4 6
DFS traversal of this graph would result in: 1, 2, 4, 5, 3, 6,
In this example, starting from node 1 (considered as the root), DFS goes to node 2, and then it goes to node 4. Since
node 4 has no children, it backtracks to node 2 and visits node 5. Again, as node 5 has no further nodes to visit, it
backtracks to node 1. Finally, it visits node 3 and node 6.
Breadth-First Search (BFS) is a fundamental graph traversal algorithm used in computer science and mathematics
to explore all nodes of a graph or tree data structure. The strategy of BFS is to explore the graph "broadly" before
going "deep". That is, it visits all the nodes at the current level before moving on to the next level.
The BFS algorithm starts at an arbitrary root node, then explores all the neighbour nodes at the present depth level,
and then moves on to nodes at the next depth level. It does this by using a queue data structure to keep track of
nodes to be visited. Nodes are visited and dequeued (removed), then all unvisited neighbours of the current node
are enqueue(inserted) and marked as visited.
The term "breadth" in BFS refers to the breadth, or width, of the tree or graph. BFS explores all the neighbour nodes
at the current level before proceeding to nodes at the next level. refers to the process of visiting and examining each
node. In contrast, "search" refers to the process of visiting and examining each node.
For instance, imagine a family tree where BFS starts at the root of the tree (the oldest known ancestor). It first visits
all the children (level one descendants), then all the grandchildren (level two descendants), and so forth, until all
descendants at each level are visited. In other words, BFS visits nodes in a way that fills up each level of the family
tree from left to right before descending to the next level.
Example 1: BFS
4m
1
3
2
5
4 6
In this example, starting from node 1 (considered as the root), BFS first visits all the neighbours of node 1. which are
nodes 2 and 3. It then visits the neighbours of node 2 and node 3. So, it first visits nodes 4 and 5 which are the
children of node 2, and then it visits node 6 which is the child of node 3. Therefore, BFS fills up each level of the tree
from left to right before moving down to the next level.
17. Write Warshall algorithm to compute transitive closure of a directed graph. Apply the same on the following
graph.
The adjacency matrix is shown below
a b c d
a 0 1 0 0
b 0 0 0 1
C=D0 =
c 0 0 0 0
d 1 0 1 0
a b c d
a 0 1 0 0
C=D1 = b 0 0 0 1
c 0 0 0 0
d 1 1 1 0
Step 2:
Let k = b and obtain D2
D2 [a,a] = D1 [a,a] v [D1 [a,b] ^ D1 [b,a]] = 0 v [1 ^ 0] = 0
D2 [a,b] = D1 [a,b] v [D1 [a,b] ^ D1 [b,b]] = 1 v [1^ 0] = 1
D2 [a,c] = D1 [a,c] v [D1 [a,b] ^ D1 [b,c]] = 0 v [1 ^ 0] = 0
D2 [a,d] = D1 [a,d] v [D1 [a,b] ^ D1 [b,d]] = 0 v [1 ^ 1] = 1
a b c d
A 0 1 0 1
C=D2 = B 0 0 0 1
C 0 0 0 0
D 1 1 1 1
Step 3:
Let k = c and obtain D3
D3 [a,a] = D2 [a,a] v [D2 [a,c] ^ D2 [c,a]] = 0 v [0 ^ 0] = 0
D3 [a,b] = D2 [a,b] v [D2 [a,c] ^ D2 [c,b]] = 1 v [0 ^ 0] = 1
D3 [a,c] = D2 [a,c] v [D2 [a,c] ^ D2 [c,c]] = 0 v [0 ^ 0] = 0
D3 [a,d] = D2 [a,d] v [D2 [a,c] ^ D2 [c,d]] = 1 v [0 ^ 0] = 1
a b c d
A 0 1 0 1
C=D3 = B 0 0 0 1
C 0 0 0 0
D 1 1 1 1
Step 4:
Let k = d and obtain D4
D4 [a,a] = D3 [a,a] v [D3 [a,d] ^ D3 [d,a]] = 0 v [1 ^ 1] = 1
D4[a,b] = D3 [a,b] v [D3 [a,d] ^ D3 [d,b]] = 1 v [1 ^ 1] = 1
D4 [a,c] = D3 [a,c] v [D3 [a,d] ^ D3 [d,c]] = 0 v [1 ^ 1] = 1
D4 [a,d] = D3 [a,d] v [D3 [a,d] ^ D3 [d,d]] = 1 v [1 ^ 1] = 1
a b c d
A 1 1 1 1
C=D4 = B 1 1 1 1
C 0 0 0 0
d 1 1 1 1
18. What is Knapsack problem ? Solve the following instance of Knapsack problem using Branch-and-Bound method
where n = 4, m = 10, P = (40, 42, 25, 12) and
Solution:
Firstly, find out the pi / wi values and arrange them in descending order
𝑃𝑖 40
= = 10
𝑊𝑖 4
𝑃𝑖 42
= =6
𝑊𝑖 7
𝑃𝑖 25
= =5
𝑊𝑖 5
𝑃𝑖 12
= =4
𝑊𝑖 3
-(2m)
Total Knapsack capacity M = 10
At the root of state – space tree , no objects have been selected as yet. Hence, w and p value is set to 0. The upper bound va
ub can be computed as
Ub: 40 + (10 - 4)*10 = 100
W=0, p=0
Ub=100
Node 1 represents the subsets that include object 1. Hence, we set w, = 4 and p = 40 respectively:
𝑃2
The = 6 value of upper bound is
𝑊2 Each node – ½ m
Total – 6m
Ub: 40+ (10 - 4) 6 = 76
Node 2 represents the subsets that dose not include object 1hence, we set w = 0 and p = 0 respectively; the value of upper
bound is
Ub: 0(10-0)6 = 60
Node 3 represents the subsets that included object 1 and object 2. The value of w is sum of weights of object1 and object 2 a
𝑃3
the value of p is sum of profits of object 1 and object 2. The = 5 The upper bound value is
𝑊3
Node 5 represents the subsets that include object 1. Hence, we set w, = 4 and p = 40 respectively:
𝑃2
The = 5 value of upper bound is
𝑊2
Ub: 42+(10-7)6 = 60
Node 6 represents the subsets that dose not include object 1 and object 2 hence, we set w = 0 and p = 0 respectively; the val
of upper bound is
Ub: 0+(10-0)5 = 50
Node 7 represents the subsets that included object 1 and object 2 , and object 3. The value of w is sum of weights of object1
𝑃3
and object 2 and object 3 and the value of p is sum of profits of object 1 and object 2. The = 4 The upper bound value is
𝑊3
not possible because M=10 only
Node 8 represents the subsets that does not include object 1 and object 2 hence, the value of upper bound is
not possible because M=10 only
Node 9 represents the subsets that included object 1 and object 2 , and object 3. The value of w is sum of weights of object1
𝑃3
and object 2 and object 4 and the value of p is sum of profits of object 1 and object 2. The = 1 The upper bound value is
𝑊3
Node 11 represents the subsets that included object 2 , and object 3. The value of w is sum of weights of object1 and object 2
𝑃3
and object 4 and the value of p is sum of profits of object 1 and object 2. The = 1 The upper bound value is
𝑊3
Node 12 represents the subsets that include object 2 hence, the value of upper bound is
Ub : 42+(10-7)1 = 45
W=0, p=0
Ub=100
With 1 with out 1
Not feasible