Assignment No. 03
Total Marks: 20
Due Date: 18/01/2013
Please read the following instructions carefully before submitting assignment:
To understand the real applications of greedy algorithm.
For any query about the assignment, contact at email@example.com
Question 1: Marks 10
After reviewing the activity scheduling with greedy approach, suppose that instead of always selecting the first activity to finish, we instead select the last activity to start that is compatible with all previously selected activities. Describe how this approach is greedy algorithm and prove that it yields an optimal solution.
Question 2: Marks 10
Mr. Mohsin drives a car from Lahore to Rahim Yar Khan along National Highway, His car’s gas tank, when full, holds enough gas to travel n miles, and his map gives the distance between gas station on his route. Mohsin wishes to make as few gas stops as possible along the way.
Give an efficient method by which Mohsin can determine at which gas stations he should stop, and prove that your strategy yields an optimal solution.
BEST OF LUCK
+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)
+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)+ Click Here to Search (Looking For something at vustudents.ning.com?) + Click Here To Join (Our facebook study Group)
Please Discuss here about this assignment.Thanks
Our main purpose here discussion not just Solution
What are the best applications of greedy algorithm?
Greedy algorithms are fast. Therefore, if it can be proven that they yield the global optimum for a certain problem, they will be the method of choice. The technique is used in the following graph algorithms which have many practical applications:
1. Dijkstra's algorithm for finding shortest path to all nodes given a start node
2. Prim's algorithm for finding a minimum spanning tree
3. Huffman trees for data compression
The problem with the greedy approach is that most of the time you obtain only some local optimum and not the global one. In such cases you might want to consider a more powerful "tool" like Dynamic Programming. There is a time trade-of, though.
There are cases when, even though greedy algorithms does not guarantee the global optimum, we still might want to use them to get a good approximation for the answer to the problem. For example consider the following situation:
You have a set of n items and you want to place them in several fixed-size boxes. Your goal is to minimize the number of boxes used. A greedy approach where you process the items in the order they are first given, placing them in the first box they fit in, is not optimum but it never takes more than twice the actual minimum number of boxes
please discus about this assgnment
Dear All it would be great if the Pin Pointed discussion may be initiated.
The answer of first question in the previous assingment see :)
nice find !!
both are different questions
1st question solve kar leya hai 2nd solve ni keya muj 2nd ki samaj ni a rahi hai...
aaj last date hai....
koi 2nd question ka idea hi dai dain
I think Question 2 is about Minimum Spanning Tree topic.
try to solv n share ali.....................
any one who have an idea how to solve this????????????????????