You are canoeing down a river and there are n renting posts along the way. Before...
There are n trading posts along a river. At any of the posts you can rent a canoe to be returned at any other post downstream. (It is next to impossible to paddle against the current.) For each possible departure point i and each possible arrival point j the cost of a rental from i to j is known. However, it can happen that the cost of renting from i to j is higher than the total cost of a...
There are n trading posts numbered 1 to n as you travel
downstream. At any trading post i you can rent a canoe to be
returned at any of the downstream trading posts j>i. You are
given a cost array R(i,j) giving the cost of these rentals for all
1≤i<j≤n. We can assume that R(i,i)=0, and that you can't go
upriver (so perhaps R(i,j)= ∞ if i>j). For example, one cost
array with n=4 might be the following.
The problem...
There are n trading posts numbered 1 to n as you travel downstream. At any trading post i you can rent a canoe to be returned at any of the downstream trading posts j, where j >= i. You are given an array R[i, j] defining the costs of a canoe which is picked up at post i and dropped off at post j, for 1 ≤ i ≤ j ≤ n. Assume that R[i,i] = 0 and that you...
4. Suppose you will travel on a railway and there are n ticket offices to buy a ticket along the railway. You will change trains during your journey. At the beginning, you are given for each 1 ≤ i < j ≤ n and pi,j is the price of a ticket for a train that goes from ticket office i to ticket office j. These prices are arbitrary. For instance, it is possible to see a price combination as p1,3...
Consider a long river, along which n houses are located. You can think of this river as an x-axis; the houses locations are given by their coordinates on this axis in a sorted order. Your company wants to place cell phone base stations along the river, so that every house is within 8 kilometers of one of the base stations. Give an O(n)-time algorithm that minimizes the number of base stations used. As well as giving the algorithm and showing...
(5 +2 points) You are given an array A[1..n] of positive numbers where Ai] is the stock price on day i. You are allowed to buy the stock once and sell it at some point later. For each day you own the stock you pay S1 fee. Design a divide-and-conquer algorithm that will return a pair (i,j) such that buying the stock on day i and selling it on day j will maximize your gain The complexity of the algorithm...
There is a river which flows horizontally through a country. There are N cities on the north side of the river and N cities on the south side of the river. The X coordinates of the N cities on the north side of the river are n1, n2, …, nN, and the X coordinates of the N cities on the south side of the river are s1, s2, …, sN. Assume that we can only build bridges between cities with...
Fill in the blanks with the info given.
Save Homework: Chapter 3 homework Score: 0 of 1 pt 1 of 1 (0 complete) CP3-46 (similar to) HW Score: 0%, 0 of 1 pt IE Question Help Wicked Wild Company completed the following transactions in November and December and prepared the following unadjusted trial balance at December 31, 2018: (Click the icon to view the November and December transactions.) (Click the icon to view the unadjusted trial balance.) At December 31,...
Suppose you have an array S indexed from 1 to n which contains n numbers, not in any particular order, and you wish to count how many times a given number x occurs in S. Consider the recursive algorithm below for this which finds the number of occurrences of x in the index range i...j in S. Of course, solving the problem would involve an initial call to the algorithm for the range 1.n: int CountOccur (int i,j) { int...
I NEED A MATHEMATICAL ALGORITHM FOR A CEASER CHYPER I CREATED. PLEASE HELP ME...THANK YOU! THE SINGLE-DIGIT KEY IS 14 THE PHRASE IS "GOOD MORNING PROFESSOR" THE CYPHER IS UCCR ACFBWBU DFCTSGGCF I DON'T KNOW HOW TO CREATE THE ALGORITHM AND IT CANNOT BE COMPUTER GENERATED. a. Develop a Caesar cipher-type encryption algorithm with a little more complexity in it. For example, the algorithm could alternatively shift the cleartext letters positive and negative by the amount of the key value....