PLEASE DO ASAP
ANALYSIS OF ALGORITHMS
Problem 2. (Category: Simulating and coding: Topological order] 1. Simulating: Consider the directed acyclic graph G below, how many topological orderings does it have? List all the orderings. [5 points) b a d 2. Coding: Course schedule problem (10 points] There are a total of n courses you have to take, labeled from 0 to n - 1. You are given an array prerequisites where each element prerequisites = [ci, c;] indicates that you must take course c; first if you want to take course ci. For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1. Your task is write a function that takes the number of courses n, and prerequisites array as parameter, return the ordering of courses you should take to finish all courses. If there are many valid answers, return any of them. If it is impossible to finish all courses, return an empty array.
PLEASE DO ASAP ANALYSIS OF ALGORITHMS
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
PLEASE DO ASAP ANALYSIS OF ALGORITHMS
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!