We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.


+ Link For Assignments, GDBs & Online Quizzes Solution


+ Link For Past Papers, Solved MCQs, Short Notes & More

Looking for Something at Site? Search Below

CS502 Fundamentals of Algorithms Assignment No .03 Solutions and Discussions Fall 2012 Due Date: 18/01/2013

Assignment No. 03
Semester: Fall 2012
Fundamentals of Algorithm-CS502


Total Marks: 20


Due Date: 18/01/2013



Please read the following instructions carefully before submitting assignment:


  • You will submit your assignment before or on due date on VU-LMS.
  • Assignment should be completed by your own efforts it should not be copied from internet, handouts or books.
  • You should submit your .doc File via assignment interface at VU-LMS.
  • Assignment sent via Email will not be replied and accepted/graded in any case.
  • If the submitted assignment does not open or file is corrupt, it will not be graded.
  • You will submit solution only in document (.doc or .docx) File.




To understand the real applications of greedy algorithm.



For any query about the assignment, contact at cs502@vu.edu.pk

Assignment Questions


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.



+ 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)

Views: 3787

Replies to This Discussion

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????????????????????

muj lagta hai 2nd question choose karna hai gas station 
2nd question mein mohsin ko choose karna hai best station kn sa hai or wo km se km station par ruky
is ka method batana hai




This is a member-supported website. Your contribution is greatly appreciated!

Today Top Members 

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service