{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Exam1 - assume that the water is released instantly and the...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Q1. You are given recursive CombineSort procedure that sorts input sequence A={ a 1, a 2… a n}. Find its recurrence relation T(n) and use it to calculate worst case complexity of this algorithm. (Note: Combine procedure has cn worst time complexity). Start = 1; Finish = n; BEGIN CombineSort(A, Start, Finish) IF (Start < Finish) THEN Middle=(Start + Finish)/2; CombineSort(A, Start, Middle); CombineSort(A, Middle+1, Finish); Combine(A, Start, Middle, Finish); END IF END BEGIN Q2. Water flows into Hoover dam at a variable rate throughout every month (i.e., 30 days: the tidal cycle) and water is released at a regular interval (once every month). You have the detailed water level data for a period of 30 consecutive days (not necessarily a calendar month, and not necessarily starting or ending with the time of releasing the water). Give an efficient algorithm to find out exactly when the water was released. (Assume there are no leakage, usage, groundwater absorption or evaporation losses. Also, you may
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: assume that the water is released instantly, and the monthly average of water level does not increase). Q3. According to the NASDAQ rules, share prices are announced at the beginning of every minute and the announced price is the value of the share for the next minute. (No intermediate prices are available). Also, in order to bring some sanity after the dotcom meltdown, a rule has been imposed that share prices may rise or fall only by a cent per minute (no fractional change or more than 1 cent change is allowed). However, it may also remain constant for that minute interval. You have a graph of Priceline.com share value over the day (with minute and cents as x and y axis). You want to find out exactly when the price of the share was z cents (there could be one, multiple or none instances of time when the share was priced a z cents). Design an efficient algorithm for finding that and analyze its best & worst case complexity....
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern