CMPSC 465 Data Structures & AlgorithmsSpring 2021 Paul Medvedev and Chunhao Wang HW 1Due January 28, 10:00 pmInstructions: You may work in groups of up to three people to solve the homework. You must write yourown solutions and explicitly acknowledge up everyone whom you have worked with or who has given youany significant ideas about the HW solutions. You may also use books or online resources to help solvehomework problems. All consulted references must be acknowledged.You are encouraged to solve the problem sets on your own using only the textbook and lecture notes as areference. This will give you the best chance of doing well on the exams. Relying too much on the help ofgroup members or on online resources will hinder your performance on the exams.Late HWs will be accepted until 11:59pm with a 20% penalty. HWs not submitted by 11:59pm will receive0. There will be no exceptions to this policy, as we post the solutions soon after the deadline. However, youwill be able to drop the three lowest HW grades.For the full policy on HW assignments, please consult the syllabus.1. (0 pts.) Acknowledgements. The assignment will receive a 0 if this question is not answered.(a) If you worked in a group, list the members of the group. Otherwise, write I did not work in a group.(b) If you received significant ideas about the HW solutions from anyone not in your group, list theirnames here. Otherwise, write I did not consult without anyone my group members.(c) List any resources besides the course material that you consulted in order to solve the material. If youdid not consult anything, write I did not consult any non-class materials.2. (20 pts.) Tribonaci numbersYour manager proposed to generate IDs for customers based on what he calls Tribonaci numbers. Theydefine Tribonaci numbers using the recurrence R(i) = R(i ? 1) + R(i ? 2) + R(i ? 3), with the first threeTribonaci numbers defined as R(0) = 1, R(1) = 2, R(2) = 3. They would like to assign the ith customer anID of R(i). You tell them that they are crazy and that the IDs are going to be huge; in fact, you claim that theith customer will have an ID number of at least 3i/2. Your manager, who has never taken lightly to criticism,threatens to fire you on the spot unless you can come up with a proof of your claim.(a) To save your job, use induction to prove that in fact R(i) ? 3i/2for all i ? 2.(b) Your manager is perplexed. They didnt take CMPSC360 or CMPSC465 so they dont know whatinduction is and dont understand your proof. They propose a simple recursive algorithm to computeR(i). The algorithm simply makes three recursive calls and then adds the results. You tell him thathis algorithm will take exponential time, but your manager doesnt want to hear anything more aboutinduction. They demand an intuitive picture instead of a proof. Luckily, you just covered somethinglike this in class. Draw a recursion tree that shows the cascade of recursive invocations triggered by asingle call to compute R(i). Two levels deep will suffice.3. (10 pts.) Big Oh definitions Let f and g be functions from positive integers to positive reals. In class,we saw the following definition of big Oh: O1(g(n)) = { f(n) : ? constants c1 > 0,n0 > 0 s. t. f(n) ?CMPSC 465, Spring 2021, HW 1 1c1g(n),?n ? n0}. The textbook gives an alternate definition: O2(g(n)) = { f(n) : ? a constant c2 > 0 s. t. f(n) ?c2g(n) for all n > 0}. Prove that the two definitions are equivalent. In other words, prove that O1(g(n)) =O2(g(n)) for all g.4. (20 pts.) Analyze Running Time. For each pseudo-code below, give the asymptotic running time in ?notation. (You may assume that standard arithmetic operations take ?(1) time.) You may assume that n is apower of two if it simplifies your analysis. Briefly justify your answer.1.for i := 1 to n doj := i;while j < n doj := j +5;endend2.for i := 1 to n dofor j := 4i to n dos := s+2;endend3.s := 0;i := n;while i ? 1 doi := i div 2;for j := 1 to i dos := s+1endend4.for i := 1 to n doj := i2;while j ? n doj := j +1endend5. (10 pts.) Tighter Analysis. We are going to analyze the running time of an n-bit counter that counts from0 to 2n ?1. For example, when n = 5, the counter has the following values:CMPSC 465, Spring 2021, HW 1 2Step Value # Bit-Flips0 00000 1 00001 12 00010 23 00011 14 00100 3……30 11110 231 11111 1Note that we only need to flip the last bit to go from 0 to 1, but we need to flip the last two bits to go from 1to 2. It is easy to see that to go from 0 to 2n ?1, it takes at most O(n2n) bit-flips. Show that, in fact, it takes?(2n) bit flips.(Hint: How many times is the last bit flipped? How many times is the second last bit flipped?)CMPSC 465, Spring 2021, HW 1 3
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
Our Services
Ace Writing Center has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.
Essays
At Ace Writing Center, Nowadays, students normally have extremely busy schedules. You will note that some of them have to take on some evening or weekend jobs in order to get some income that can help them to sustain in college or in the university. This can deny them a chance to write all the essays given. Others usually get bombarded with a lot of work by their lecturers. This can still delay such students from working on all their essays. However, some of them usually try to work on all these essays but end up delivering their work late. This can prevent them from graduating since most lecturers are strict on deadlines. If you want to write a business essay, the wise way is to hire an outstanding essay writing service like us, so that you can get the best results. If you are keen, you will note that many companies usually overcharge their customers. Some of them are there only to make money. And in reality, they really don’t care to build a long term commitment with students. You should not choose such companies. You should take your time and choose a reliable company to work with. Ace Writing Center is the ultimate solution for you. We have been offering our writing service for more than 7 years. This is a clear indication that you will get quality essay writing service. We have a wide range of writers who can work on any business essay that you might have. We believe in doing extensive research so that we can provide quality work to all our clients. .
Admissions
Admission and Business Papers
Have you ever had to write an admission essay for college? The majority of students face the same issues when applying to a university or college and many in such situations decide they need professional help to cope with this matter. They get in a situation when the deadline keeps coming closer but lack motivation to start because they are just not sure if their writing skills are strong enough. We have a solution for you! Ace Writing Center is the best admission essay writing service with a large professional team and years of experience in providing high-quality papers to students of all levels and faculties. The mission of our team is to help students make their dreams of entering a good college come true and that’s what we offer!.
Editing
Editing and Proofreading
Sometimes all the words for your paper just flow out of your mind and into your fingers. You type quickly at your keyboard and there they are, your beautiful words right there on the screen. But you have no idea how to polish it up. You may be wishing there was a paper writing service that offered this type of writing service. Look no more! Here at Ace Writing Center, we offer you an editing and proofreading option that you can't find anywhere else..
Coursework
College Essay Writing
In case you are familiar Ace Writing Center, you know the way to distinguish a better company from a cheap one exactly. First of all, poor service website does not have a sufficient support. We think support team is an essential part of success; it has to answer all clients’ questions and be a connecting link between clients and their writers. On our web-service you will get answers about anything you need and your writer will receive all your instructions, assignments and requirements exactly and swiftly. A writing service that we run has got a flexible pricing system that will save you from senseless wastes and many bonus systems that let you sparing money for something important for you.