From the following list of bus rapid transit system (one way): Name Route Vacation A->B->C->D Work 1 E->B->F->G->H Work 2 B->N->E Work 3 H->D->N The problem: ➢ Task: Design an algorithm to read the bus rapid transit system routes list and print the number of tickets we need to purchase if we want to visit all places minimal twice. The complexity of the algorithm must be O(V+E). V is the number of places. E-> is the number of transits. ➢ PS: Use Tarjan’s or Kosaraju’s strongly connected component algorithm.
Q: The weighted, undirected graph below represents a transit system, in which the vertices are train…
A:
Q: There are n persons each have 25 paise coins, 50 paise coins and Rs1 coins in the ratio p:q:r but…
A: The ask is to write a C program to find and print no. of 25 paise coins, 50 paise coins and 1 Rs…
Q: Semon 2 1/1 75% Create a Python function, named PERT, that receives 4 parameters as input: TLIK,…
A: Below i have answered the question:
Q: Input: A set of n movies. A positive integer k. A positive integer q. A function f that takes two…
A: Answer: Given, Set of n movies, positive constant k and q and {X,Y} ∈ n I have written algorithm…
Q: a class to implement a queue using a circular array The class should contain functions…
A: Step 1: Below the C++ program according to your requirement
Q: Consider the elliptic curve group based on the equation y = x' + ax +b mod p where a = 2, b = 1, and…
A: Solution for the above question is solved in step 2:-
Q: PYTHON PROGRAMMING Submit a code snippet for a function (in the coding sense) that accepts as an…
A: PROGRAM INTRODUCTION: Take the number from the user as input. Use a loop to iterate the number from…
Q: PYTHON Suppose that I have a list of lists: a = [ [25, 2, 5, 6, 8], [20,10,3,0,4], [2,5,9,2,2] ] I…
A: The program is implemented in Python using structured approach. In program we have a 2d list. The…
Q: Stacks are useful in situations where: (There maybe more then one answer) A. a higher priority…
A: Stacks are useful when the items are to be processed in LIOF, that is, Last In First Out order.…
Q: IN PYTHON: Write a function for each of the following scheduling algorithms. the parameter for the…
A: Python program to find Average wait time, Average response time and Average turnaround time
Q: Greedy algorithm - Scheduling WeShip2You Inc., a transportation company that ships oversized goods…
A: INPUT/OUTPUT: 1. Input 107109693870000000 Output Oversized items loaded into each truck: 1 1 1 1 1…
Q: nstead of reading in an entire list N1,N2,⋯N1,N2,⋯ all at once, some algorithms (depending on the…
A: In this question, we are asked to write a java program which calculate the average of numbers in…
Q: Jsing dynamic programming with the items ordered as listed (i.e., do not sort), v What is B[k=2,w=3]…
A: Here we fill the data using the Tabular method .…
Q: Write a function gravity that evaluates y(t) = v0t - (1/2) gt2 at n uniformly spaced times between…
A: A function is a code which possibly runs when it is called. You can pass information, known as…
Q: From the following list of bus rapid transit system (one way): Name Route Vacation : A->B->C->D Work…
A: Kosaraju’s algorithm: To find a SCC(strongly connected Components) in a graph KOSARAJU ALGORITHM…
Q: n), starting point (i), direction (clockwise/anti-clockwise) and number to be skipped (k). Your…
A: Q. Your task is to develop a circular linked-list based simulation of the Josephus problem.…
Q: write a python function that finds the average of that column. The lists will contain None values…
A: Python Code: # function to find mean of lists def f_mean(dlist): m_list = [] l_list =…
Q: Priority queues can have fast insertion or fast removal, but not both. Please select all of the…
A: Priority Queue : This queue is used to store the data elements with every element having a number…
Q: Table 1 Execution Time Arrival Time 3 unit time Task ID T1 to T2 T3 5 unit time t1 2 unit time t3 T4…
A:
Q: Task 8 Write a python program that takes a list from user containing both positive and negative…
A: Algorithm: The algorithm for the given problem is: Start Take value of n and the list elements…
Q: There are n persons each have 25 paise coins, 50 paise coins and Rs1 coins in the ratio p:q:r but…
A: #include <bits/stdc++.h> using namespace std; // function to calculate coin. int coin(int…
Q: A company "XYZ" is manufacturing two types of grinders, called X and Y. The grinders X and Y are…
A: NOTE: I am assuming that all the grinders are stored in queue intially start Declare a temporary…
Q: Write a Python program that will accomplish the following tasks: 1. Create an empty list to save the…
A: List: In Python, a list is a data type, that stores a collection of different objects (items) within…
Q: Task 8 Write a python program that takes a list from user containing both positive and negative…
A: Algorithm: Start Read a list of numbers, say numbers Sort the list Assign s=0 and e=len(numbers)-1…
Q: Write a python program to cluster candidates into 2/3 groups. The program performs dimensionality…
A: I have done this. I am reading the data of above table. I am going to pandas library to create a…
Q: A factory produces bars whose exact length is unknown until after production. Its cutting shop…
A: PROGRAM SETOFORDERS (input, output); (* This program reads a bar length and a *) (* list of…
Q: 6. You have taken a new job with a small marketing platform. Their main line of business is to send…
A: Email marketing is an ideal way to communicate with your customers. Sending email is fast, free and…
Q: PYTHON QUESTION : The Syracuse sequence of an integer N is the sequence of integers starting with…
A: n = x = maxNum = 1 print(n) while n != 1: if n%2 == 0: n = n // 2 # where n //= 2 or n…
Q: write a python function that finds the average of that column. The lists will contain None values…
A: We need to write python program to print the following output and input. See below steps for code. I…
Q: Solve this problem in JS Create a multi-digit task and return "Boom!" if digit 7 appears in the…
A: Algorithm - create a function sevenBoom with one argument. merge the array values and check if it…
Q: Given a list of integers, for each of the elements - --- if an item is divisible by 2, square it ---…
A: def list(l =[]): for i in range(0, len(l)): if l[i] % 2 == 0: l[i] =l[i]**2…
Q: Modify the program below to accommodate any number of customers with a maximum of 10 customers…
A: I am modifying only insert method and constructor in order to achieve the above task. Modifying…
Q: Explain with relevant example these Python expressions Accumulation Loops o Accumulate with For •…
A: Answer The Accumulator Pattern is a type of accumulation pattern. There are some patterns that you…
Q: The CPU of a computer handles the processes using shortest-job-first policy, which means, given the…
A: We are given shortest-job-first policy to schedule the processes. And we are asked about the data…
Q: Python Activity Big-O Coding Exercise Show your solution and explanations. Submit a code snippet for…
A: PROGRAM INTRODUCTION: Take the number from the user as input. Use a loop to iterate the number from…
Q: Write a Python script to enter and print the two lists X[10] and Y[10], then find and print the…
A: Please upvote. I am providing you the correct answer below. Please please please
Q: Assume you have an array of 5 queues called line. The queue at position 0 is filled with four…
A: In Queue, enqueue inserts an element at end and dequeue removes element from front Given line is…
Q: I need help with a Java Project. Create a Java program that will allow a user to book a plane…
A: Flight booking While OTAs and metasearch engines are the preferred option at the search stage, the…
Q: In Python, A list may contain {0,1,2}, find the number of strings of size n that do not contain two…
A: Algorithm: 1. Create a list of lists 2. Create a list of numbers 3. Call rec(list_of_lists,…
Q: When an author produces an index for his or her book, the first step in this process is to decide…
A: Actually, program is an executable software that runs on a computer. c++ is a powerful general…
Q: air of values in the list N that sum to the value SUM. For example, if your list of values is 3,…
A: Design and implement an algorithm that gets as input a list of k integer values N1, N2,..., Nk as…
Q: PYTHON PROGRAMMING Submit a code snippet for a function (in the coding sense) that accepts as an…
A: Here is python program implementation: See below step.
Q: Consider the elliptic curve group based on the equation y = r° + az +b mod p where a = 4, b = 6, and…
A: Appying threr Double and Add algorithm we get the following points P (1,2) Point is on…
Q: When an author produces an index for his or her book, the first step in this process is to decide…
A: //Data stored in the node type struct WordCount { string word; int count; }; //Node type:…
Q: python program
A: def aStarSearch(map): start = (9, 0)end = (0, 9) openList = []closedList = [] path = []…
Q: need help in python PYTHON PROGRAMMING Submit a code snippet for a function (in the coding…
A: Here is the python code to implement the above problem. See below steps
Q: For a list L, L[i] = item operation is a ____ operation, if i is less then len(L). Question 8…
A: Here, in this question, they have given list and asked complexity. You can determine complexity like…
Q: write a python function that finds the average of that column. The lists will contain None values…
A: * Python Code * # function to find mean of lists def find_mean(datalist): mean_list = [] # empty…
Q: 2) Write a program to calculate average waiting time for Shortest Job First algorithm for following…
A: Java code to calculate the average waiting time In SJF algorithm is given below in detail.
Q: ht reservation system, the number of available seats in each plane model is an input. A plane may…
A: Basically, Boundary Value Analysis is a technique that is used for software testing. The valid and…
From the following list of bus rapid transit system (one way):
Name Route
Vacation A->B->C->D
Work 1 E->B->F->G->H
Work 2 B->N->E
Work 3 H->D->N
The problem:
➢ Task: Design an
of tickets we need to purchase if we want to visit all places minimal twice. The complexity of
the algorithm must be O(V+E). V is the number of places. E-> is the number of transits.
➢ PS: Use Tarjan’s or Kosaraju’s strongly connected component algorithm.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Exercise #2: Write the Algorithm Write the requirements and algorithm below for the following problem: ETET Problem: 国 動三 The registration fee for at an institute is 1000 dirhams if you register for 5 courses or less. First five courses cost, 2000 dirhams per course. For example, if you register for 3 courses, then you will pay 7000 dirhams including the registration. If you register for 5 courses, then you will pay 11000 dirhams. If you register for more than five courses, then there is no registration fee. First five courses will cost 2000 dirhams per course, but any extra course after the five courses will cost 1500 dirhams per course. For example, if you register for 7 courses then it will gost 13000 dirhams. If you register for 10 courses, then the cost will be 17500. Create the algorithm to solve this problem, if you are given the number of courses then how will you calculate the total cost? Requirements: (Write the requirements (input and output) below) Algorithm: (Write the…4. CodeW. X b For fun X Solved x b Answer x+ Ohttps://codeworko... CodeWorkout X264: Recursion Programming Exercise: Multiply For function multiply,write the missing base case condition and action. This function will multiply two numbers x and y.You can assume that both x and y are positive. Examples: multiply(2, 3) -> 6 Your Answer: 1 public int multiply(int x, int y) { 2. if > { > } else { return multiply(x 1, y) + y; 3. 5. { 7. 1:08 AM 50°F Clear 日The code box below defines a variable route as a list of directions to navigate a maze. Each instruction is one of the following four basic commands: • higher. move one step in the positive y direction • lower: move one step in the negative y direction • left: move one step in the negative x direction right: move one step in the positive x direction ● Define a function move that takes two arguments, a location (as a tuple of x and y coordinates) and an instruction (higher, lower, left, right) as a string. Given the provided location, it should return the new location (as a tuple of x and y coordinates) when following the specified instruction. If the instruction is invalid, the old location should be returned. Use the function move to determine the final position when starting from the point (-2, -1) and following all instructions in the list route. Assign this final position to the variable final_location. Reset answer 1 route = ['right', 'higher', 'left', 'lower', 'higher', 'left',…
- Question-1 Using Python Friend’s Party Circle: There are a few friends living in the same area. They have a party every weekend and the place of party change each week. It is always a difficult task to select a place which is nearest for everyone. They all decided to take advantage of Computer Science to solve this problem. Names of friends are Ahmed, Rehman, Careem, Basit, Dawood, Ghani, and Farid. Ahmed lives at 5 minutes’ walk from rehman and at 10 minutes’ walk from Careem. Careem lives at 3 minutes’ walk from Dawood. Rehman lives at 4 minutes’ walk from Basit and 2 minutes’ walk from Dawood. Dawood lives at two minutes’ walk from Farid. Ghani lives at 2 minutes’ walk from Basit. If we represent a graph G = V (V, E) in which set of vertices are home of each Friend and an edge represents a path between two homes. Provide the adjacency matrix of directed graph of the graph G. In above directed graph G. You are required to devise an…The code box below defines a variable route as a list of directions to navigate a maze. Each instruction is one of the following four basic commands: higher move one step in the positive y direction • lower. move one step in the negative y direction • left: move one step in the negative x direction • right: move one step in the positive x direction Define a function step that takes two arguments, a location (as a tuple of x and y coordinates) and an instruction (higher, lower, left, right) as a string. Given the provided location, it should return the new location (as a tuple of x and y coordinates) when following the specified instruction. If the instruction is invalid, the old location should be returned. Use the function step to determine the final position when starting from the point (0, -4) and following all instructions in the list route. Assign this final position to the variable final_point.Assignment for Computer Architecture You are to write a program in MIPS that computes N! using recursion. Remember N! is the product of all the numbers from 1 to N inclusive, that is 1 x 2 x 3 x (N – 1) x N. It is defined as 1 for N = 0 and is undefined for values less than 0. The programs first requests the user to input the value of N (display a prompt first so the user knows what to do). If the input value is less than 0, the program is to display “N! undefined for values less than 0” and then requests the user to input the value of N again. If the value input is non-negative, it is to compute N! using a recursive function, that is one that calls itself. You are to have your name, the assignment number, and a brief description of the program in comments at the top of your program. Since this is an assembly language program, I expect to see comments on almost every line of code in the program. Also make the code neat: line up the command fields, the register fields, and the comment…
- PYTHON RECURSIVE FUNCTION Write a python program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one word names, then use a recursive method to create and output all possible orderings of those names, one ordering per line. When the input is: Julia Lucas Mia then the output is (must match the below ordering): Julia Lucas Mia Julia Mia Lucas Lucas Julia Mia Lucas Mia Julia Mia Julia Lucas Mia Lucas Julia(Data processing) Your professor has asked you to write a C++ program that determines grades at the end of the semester. For each student, identified by an integer number between 1 and 60, four exam grades must be kept, and two final grade averages must be computed. The first grade average is simply the average of all four grades. The second grade average is computed by weighting the four grades as follows: The first grade gets a weight of 0.2, the second grade gets a weight of 0.3, the third grade gets a weight of 0.3, and the fourth grade gets a weight of 0.2. That is, the final grade is computed as follows: 0.2grade1+0.3grade2+0.3grade3+0.2grade4 Using this information, construct a 60-by-7 two-dimensional array, in which the first column is used for the student number, the next four columns for the grades, and the last two columns for the computed final grades. The program’s output should be a display of the data in the completed array. For testing purposes, the professor has provided the following data:(Statistical) In many statistical analysis programs, data values considerably outside the range of the majority of values are simply dropped from consideration. Using this information, write a C++ program that accepts up to 10 floating-point values from a user and determines and displays the average and standard deviation of the input values. All values more than four standard deviations away from the computed average are to be displayed and dropped from any further calculation, and a new average and standard deviation should be computed and displayed.
- Python Answer Required: A Rajesh teaches a cooking class. The course is attended by NN students, numbered 11 to NN. The cook must participate in the presence before each class, i.e. call out the names of the students one by one and indicate which students are present. Each student has a first and last name. To save time, Rajesh only wants to call up students' first names. However, if there are multiple students with the same first name, the Rajesh must call out the full names (first and last names) of all those students. For any student who does not share a first name with any other student, the cook can still only call that student's first name. Help the Rajesh decide for each student whether to call that student's full name or just their first name. Input 1 1 hasan jaddouh Output hasanPython Question You are working on a problem where the size of each test case is between 1 and 100 integers and where the timeout is 4 seconds.You have developed a cubic time algorithm for the problem that gives the correct answeron all test cases.If you submit that solution, will you pass all test cases in time?Please answer YES or NO and then briefly explain your answer.To do :YES/NO answer with explanationExponent y Catherine Arellano mplement a recursive function that returns he exponent given the base and the result. for example, if the base is 2 and the result is 3, then the output should be 3 because the exponent needed for 2 to become 8 is 3 (i.e. 23 = 8) nstructions: 1. In the code editor, you are provided with a main() function that asks the user for two integer inputs: 1. The first integer is the base 2. The second integer is the result 2. Furthermore, you are provided with the getExponent() function. The details of this function are the following: 1. Return type - int 2. Name - getExponent 3. Parameters 1. int - base 2. int - result 4. Description - this recursive function returns the exponent 5. Your task is to add the base case and the general case so it will work Score: 0/5 Overview 1080 main.c exponent.h 1 #include 2 #include "exponent.h" 3 int main(void) { 4 int base, result; 5 6 printf("Enter the base: "); scanf("%d", &base); 7 8 9 printf("Enter the result: ");…