# Algorithms: Question Set – 18

#### What is NP-Complete?

An NP-Complete problem is a problem in NP that is just as challenging as any other problem in this category. This is because any other dispute in NP can be reduced to it in polynomial time, making it the most difficult problem in NP.

#### What is the Order of Algorithm?

The order of an algorithm is the standard documentation of an algorithm that has been developed to represent a task that bound the estimated time for algorithms. This documentation was developed so that an algorithm could be used to create a representation of the task. The order in which steps are performed in an algorithm is one way that effectiveness can be measured. O-notation is the name that most people give to this notation.

#### What is Brute Force approach?

The term “brute force” refers to a straightforward approach to problem solving that is typically directly based on the statement of the problem as well as descriptions of the concepts that are involved.

#### What do you mean by the optimal solution?

We are able to recover a subset that satisfies the constraints after considering the problem with the inputs. A solution is considered feasible if and only if it contains a subset that satisfies the constraints. An optimal solution is a feasible solution that either maximises or minimises a given purpose method. This type of solution is known as a solution that is optimal.

#### What is the Knapsack Problem?

Find the most valuable subsets of the elements that can fit into a knapsack with a capacity of W, given n elements with known weights wiand values vi, where i=1, 2…n, and a knapsack with that capacity. It is more practical to arrange the components of a certain instance in a descending order based on the value-to-weight ratios of the individual components. Therefore, the first component provides the highest return on investment per unit of weight, while the final one provides the lowest return on investment per unit of weight.

#### What is Warshall’s Algorithm?

Finding the transitive closure of a directed graph requires using Warshall’s algorithm, which is a function of the dynamic programming procedure. This procedure is used to find the closure.

#### List the advantage of the greedy algorithm.

• The greedy method produces a feasible solution
• The greedy method is very easy to solve a problem
• The greedy method implements an optimal solution directly

#### What is Minimum Spanning Trees?

• A tree is considered to be a spanning tree for a linked graph if the vertex set of the tree is identical to the vertex set of the given graph and the edge set of the tree is a subgroup of the edge set of the given graph. That is to say, a spanning tree is a component of every linked graph.
• The sum of the weights of each edge in a spanning tree is the weight of the tree, denoted by the symbol w (T). The Minimum Spanning Tree, abbreviated MST, is a type of spanning tree that has the least amount of weight that is practically possible.

#### What is Kruskal?s Algorithm?

This is a sneaky way to get what you want. A greedy technique will select a local optimal solution (i.e., selection an edge with the smallest weight in an MST).
The following is how the Kruskal algorithm works:

• If you start with a graph that has ‘n’ vertices, you should continue to add the edge that has the shortest distance and the lowest cost, while avoiding the creation of cycles, until you have added (n minus 1) edges.
• There is a high probability that two or more edges will have the same rate. In this particular method, it does not make a difference in the order in which the edges are chosen.
• There is a possibility that the minimum spanning tree that is produced will be different, but whatever tree is produced will always have the same total cost, which is the lowest possible cost.