Welcome to our site, this site helpful for you that we will provide online tips SEO, Link building, earn money online, easily Money making tips.

Thursday, July 25, 2019

State travelling salesman problem

State traveling salesman problem

 The generalized traveling salesman problem, also known as the traveling politician problem, deals with states that have cities and the salesman has to visit exactly one city from each state.

What are the difference between Prim's and Kruskal's algorithm?

 In Kruskal's algorithm, it began with an edge but in prim's algorithm, it starts with a node. kruskal's algorithm works on both connected and disconnected graphs while in prim's algorithm restricted on a connected graph. Kruskal's has a time complexity of O(log V) while primi's time complexity is O(v2).

  State the dynamic programming approach of designing the algorithm.

 Dynamic programming is also used in optimization problems. like the divide and conquer method, Dynamic programming takes care of issues by joining the arrangements of subproblems. Thes properties are covering subproblems and ideal substructure.

 state the heap sort algorithm

 A heap sort algorithm is a sorting technique that is based exclusively upon a binary heap data structure. It involves finding the largest element and sorting it at the end of an unsorted collection.

Write down the two properties of a good algorithm

Input- The algorithm must have input values from a specified set
Output- The algorithm must produce the output values from a specified set of input values. The output values are the solution to a problem.

Finiteness- For any info, the calculation must end after a limited number of steps

Definiteness- All means of the calculation must be exactly characterized.

Difference between greedy and dynamic algorithm


1. A greedy algorithm is one that at a given point in time, makes a local optimization
2. The greedy algorithm has a local choice of the subproblem that will lead to an optimal solution.
3. More efficient as compared to dynamic programming.

Dynamic algorithm

1. Dynamic programming can be thought of as smart recursion. It often requires one to break down a problem into smaller components that can be cached.
2. Dynamic programming would solve all dependent subproblems and then select one that would lead to an optimal solution.
3. Less efficient as compared to the greedy approach.


No comments:

Post a Comment