0% found this document useful (0 votes)
31 views

Lab Week 10 Questions-1

This document provides 7 problems related to algorithms covered in a COL106 lab class. It divides the problems into Easy, Medium, and Hard categories. The Easy problems involve implementing topological sort, Tarjan's algorithm for strongly connected components (SCCs), and Dijkstra's algorithm for shortest paths. The Medium problems apply Dijkstra's algorithm to minimum effort paths and an intentionally vague problem. The Hard problems involve "Swim in Rising Water" and a "Strange Printer" problem. Students are encouraged to discuss all problems with friends and TAs.

Uploaded by

chataniket04
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Lab Week 10 Questions-1

This document provides 7 problems related to algorithms covered in a COL106 lab class. It divides the problems into Easy, Medium, and Hard categories. The Easy problems involve implementing topological sort, Tarjan's algorithm for strongly connected components (SCCs), and Dijkstra's algorithm for shortest paths. The Medium problems apply Dijkstra's algorithm to minimum effort paths and an intentionally vague problem. The Hard problems involve "Swim in Rising Water" and a "Strange Printer" problem. Students are encouraged to discuss all problems with friends and TAs.

Uploaded by

chataniket04
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COL106 Lab Week 10 Questions

Easy

For this week - let’s just try to implement some of the algorithms that we have

🙂
learned in the class. The algorithms might seem tough, so its best to understand
them first, and try to code them up

Problem 1: Course Scheduling

Let’s start with the Topological Sort Algorithms. We will use the same example as class -
Given a set of courses and pre-requisites, we want to determine if it is possible to complete
all the courses. The condition we need to check is that - we can only do a course if we have
already done its pre-req.

Infact, using Topo-sort algorithm, you can also give a valid ordering of courses. You should
try coding this up, and submit your solution here. If you want to also return ordering of
courses, submit your solution here instead.

Problem 2: Tarjan’s algorithm for SCCs

You might want to recall Tarjan’s algorithm from your class notes/slides.

Given a Graph G = (V, E), the task is to find the strongly connected components using
Tarjan’s algorithm.

You can submit and check your solution here.

Problem 3: Shortest Path using Dijkstra’s Algorithm

Given a graph G = (V, E), the task in this problem is to find the shortest path from a node to
all other nodes in the graph. You should use the algorithm that you have learned in the class.

You can submit and check your solution here.


Medium

😀
Once you know how to implement these algorithm, we should now move to some interesting
applications.

Problem 4: Minimum Effort Path

Let’s start one which applies the shortest path algorithm. In this problem, you need to find a
path with “minimum effort”. According to the question - “A route's effort is the maximum
absolute difference in heights between two consecutive cells of the route.”

While this question might seem daunting at first, remember that Dijkstra is a “greedy”
algorithm - and you should just be greedily trying to pick the route which requires minimum
effort.

Problem 5: Intentionally Vague Name ;)

Read the problem statement here.

The first step in such a problem is to figure out what topic it belongs to (The title is
intentionally kept vague to make you think about this). Once you are able to figure that out -
convert this problem in the form that you are able to visualize, and use one of the algorithms
of section 1. For more hints, do ask your group TA.

Hard

Most of the problems, using the topics for this week, are generally hard. (Infact, the TA who
made this sheet had to spend more time finding the medium problems than the hard ones).
You are encouraged to discuss these problems - with your friends and your group TAs.

Problem 6: Swim in Rising Water

Refer to the problem statement here.

Again, your first thoughts should be on which topic this problem belongs to.
Once you have done this problem - you should also reason about the Time and Space
Complexity of your algorithm.

Problem 7: Strange Printer

Refer to the problem statement here.

You might also like