COT5405 Analysis of Algorithms Midterm 1 Solution
Summer 2012 June 11 In all cases explain clearly and as succinctly as possible. Problem 1 10 Pts
Answer: n T (n) = 2T ( n ) + log n 2 2 n = 4T ( n ) + logn n + log n 4 2 2 2 n = 4T ( n ) + log nn−1 + log n 4 2 2 = ... ∑log2 n 1 = nT (1) + n i=1 i ∑n Since i=1 1 → ln n, T (n) ∈ Θ(n log log n) i
Problem 2
20 Pts
Answer: The general idea is to use the technique similar to quick sort, by doing partition on both lids and cups. First we pick a cup randomly, and use it to partition the lids into two subsets: those lids smaller than the size of that cup, and those larger than the size of the cup. We can also ﬁnd the correspondent lid for that chosen cup. Second we use that lid to partition the cups and divide them into two sets. We keep on repeating this procedure on each subset of cups/lids until all the cups/lids are paired. The overall time complexity is O(n log n) (Worst case: O(n2 )).
Problem 3
20 Pts
Answer: In this problem we are more interested in ﬁnding the median instead of the minimum/maximum element. The ⌊ n ⌋th element in a min/max heap is not the median. 2 In this case, we should develop a new type of heap to adapt this problem.
Problem 3
2
The solution is to use two heaps: a min heap and a max heap. Suppose the total number of elements is n, we set the restriction that the max heap should contain ⌊ n ⌋ 2 elements. Correspondingly, the min heap contains n − ⌊ n ⌋ elements. 2 When we insert an element, we always insert it into the max heap. If the number of elements in the max heap exceeds ⌊ n ⌋, we remove the maximum element in the 2 max heap (the root), and insert it into the minimum heap. During this procedure, we need to do heapify to maintain the heap structure for both heaps. Under this setting, it is easy to see that all the elements in the max heap are less than those in the min heap, and the two elements at the root of both heaps represent the ⌊ n ⌋th 2 and (⌊ n ⌋ +...
...MBA 607
Examination I
I will select five of the following questions for the midterm exam. You should be able to answer all of them. You may work together in study groups and analyze and answer the questions. Obviously, the exam will be an individual effort.
1 Accounting and Control
The controller of a small private college is complaining about the amount of work she is required to do at the beginning of each month. The president of...
...Question 1
0 out of 5 points
A term for a target population’s abilities, current resources, and future resources is
Question 2
5 out of 5 points
Which of the following is NOT a key element to include in a mission statement
Question 3
5 out of 5 points
Caution should be used when using only existing lists as a sampling frame because they
Question 4
5 out of 5 points
What creates the basis or foundation for program...
...two may be folded into existing positions in the rest of the company. This memorandum includes a brief description of each employee, my recommendation for termination or retention, possible risks that may be inherent with each particular employee in terms of post termination litigation, and severance offered if applicable.
Sally James
Ms. James is a 55 year old White female. She is beloved at the company for her friendliness and willingness to help others. Sally is an...
...Week 5  Midterm Exam
1. You are considering purchasing a personal computer. What factors would affect your price sensitivity in making the decision? How would those same factors affect the price sensitivity of some personal computer buyers differently?
Some of the things I would consider are: Customer Support, Warranty, Processing Speed, Storage, Memory, Battery life, and Networking capability. Depending on the value I place on each of these factors will determine the...
...Christian Johnson
Tracy Cave
English 1B 0744
September 24, 2013
Untitled
All stories do not speak the same tale. In order to make a story more interesting and compelling, the author must use literary devices to help the reader understand their point of view. Some devices are obvious to the reader immediately, such as narration, characters and theme. Other literary devices are more subtle, and become revealed as the story is read. The style, tone and language of an author helps the...
...1. (TCO A) Direct material cost is a part of: (Points : 6)
Conversion Cost YES.... Prime Cost NO
Conversion Cost NO.... Prime Cost YES
Conversion Cost YES.... Prime Cost YES
Conversion Cost NO.... Prime Cost NO 

2. (TCO A) The costs of staffing and operating the accounting department at Central Hospital would be considered by the Department of Surgery to be: (Points : 6)
direct costs.
sunk costs.
incremental...
...Questions (1 point for each blank)
8. The total capacitance of an ideal MOS structure includes the capacitance of ____SiO2_______ and the capacitance of _____depletion_region____________. 1. The Hall effect measurements yield the following information about a piece of semiconductor : ____type of the material___________ , ______doping concentration_____________ , _________mobility________________________. 9. For a realistic MOS structure, the threshold voltage...
...was the key theological issue at the Council of Nicea?
Explain the key difference between the Creed of Arius and the Nicene Creed.
What was the key theological issue at the Council of Chalcedon.Study items for the Middle Ages / Faith and Reason
1. Explain how the three threads of the medieval synthesis were dominant or in decline in the early and late Middle Ages. (In other words: discuss the three groups that were influential during the early and late Middle Ages. Discuss...
1007 Words 
3 Pages
Share this Document
{"hostname":"studymode.com","essaysImgCdnUrl":"\/\/imagesstudy.netdnassl.com\/pi\/","useDefaultThumbs":true,"defaultThumbImgs":["\/\/stmstudy.netdnassl.com\/stm\/images\/placeholders\/default_paper_1.png","\/\/stmstudy.netdnassl.com\/stm\/images\/placeholders\/default_paper_2.png","\/\/stmstudy.netdnassl.com\/stm\/images\/placeholders\/default_paper_3.png","\/\/stmstudy.netdnassl.com\/stm\/images\/placeholders\/default_paper_4.png","\/\/stmstudy.netdnassl.com\/stm\/images\/placeholders\/default_paper_5.png"],"thumb_default_size":"160x220","thumb_ac_size":"80x110","isPayOrJoin":false,"essayUpload":false,"site_id":1,"autoComplete":false,"isPremiumCountry":false,"userCountryCode":"US","logPixelPath":"\/\/www.smhpix.com\/pixel.gif","tracking_url":"\/\/www.smhpix.com\/pixel.gif","cookies":{"unlimitedBanner":"off"},"essay":{"essayId":36551530,"categoryName":"Literature","categoryParentId":null,"currentPage":1,"format":"text","pageMeta":{"text":{"startPage":1,"endPage":2,"pageRange":"12","totalPages":2}},"access":"premium","title":"Mid Term 1 Solution","additionalIds":[16,184,2,44,7],"additional":["Law","Law\/Intellectual Property","Awards \u0026 Events","Awards \u0026 Events\/Awards","Education"],"loadedPages":{"html":[],"text":[1,2]}},"user":null,"canonicalUrl":"http:\/\/www.studymode.com\/coursenotes\/MidTerm1Solution1259170.html","pagesPerLoad":50,"userType":"member_guest","ct":10,"ndocs":"1,500,000","pdocs":"6,000","cc":"10_PERCENT_1MO_AND_6MO","signUpUrl":"https:\/\/www.studymode.com\/signup\/","joinUrl":"https:\/\/www.studymode.com\/join","payPlanUrl":"\/checkout\/pay","upgradeUrl":"\/checkout\/upgrade","freeTrialUrl":"https:\/\/www.studymode.com\/signup\/?redirectUrl=https%3A%2F%2Fwww.studymode.com%2Fcheckout%2Fpay%2Ffreetrial\u0026bypassPaymentPage=1","showModal":"getaccess","showModalUrl":"https:\/\/www.studymode.com\/signup\/?redirectUrl=https%3A%2F%2Fwww.studymode.com%2Fjoin","joinFreeUrl":"\/essays\/?newuser=1","siteId":1,"facebook":{"clientId":"306058689489023","version":"v2.8","language":"en_US"},"analytics":{"googleId":"UA327183211"}}