Page 1 of 1

PLEASE DO ASAP ANALYSIS OF ALGORITHMS

Posted: Sat May 14, 2022 3:13 pm
by answerhappygod
PLEASE DO ASAP
ANALYSIS OF ALGORITHMS
Please Do Asap Analysis Of Algorithms 1
Please Do Asap Analysis Of Algorithms 1 (75.65 KiB) Viewed 43 times
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.