subject

Mergesort3: your friend suggests the following variation of mergesort: instead of splitting the list into two halves, we split it into three thirds. then we recursively sort each third and merge them. mergesort3 (): if n < = 1, then return a[1..n] let k = n/3 and m = 2n/3 mergesort3(a[1..k]) mergesort3(a[k+1..m]) mergesort3(a[m+1..n)merge3(a[1..k], a[k+, a[m+1..n])return a[1..m].merge3(l0, l1, l2): return merge(l0, merge(l1, that you have a function merge that merges two sorted lists of lengths q and p in time k(q+p) where k is a constant. you may assume that n is a power of 3, if you wish.(a) what is the asymptotic running time for executing merge3(l0, l1, l2), if l0, l1, l2 are three sorted lists of length n/3? give the tightest bound possible. show your work! (b) let t(n) denote the running time of mergesort3 on an array of size n. write a recurrence relation for t(n) and solve it using the tightest bounds possible.(c) compare the running time of mergesort3 to the running time of ordinary mergesort.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:50, savagesquid4807
Before you enter an intersection on a green light make sure
Answers: 2
image
Computers and Technology, 23.06.2019 18:00, yedida
File account. java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a string representation. note that the constructor for this class creates a random account number. save this class to your directory and study it to see how it works. then write the following additional code: 1. suppose the bank wants to keep track of how many accounts exist. a. declare a private static integer variable numaccounts to hold this value. like all instance and static variables, it will be initialized (to 0, since it’s an int) automatically. b. add code to the constructor to increment this variable every time an account is created. c. add a static method getnumaccounts that returns the total number of accounts. think about why this method should be static - its information is not related to any particular account. d. file testaccounts1.java contains a simple program that creates the specified number of bank accounts then uses the getnumaccounts method to find how many accounts were created. save it to your directory, then use it to test your modified account class.
Answers: 3
image
Computers and Technology, 24.06.2019 00:40, iamsecond235p318rq
To maintain clarity and focus lighting might be needed
Answers: 2
image
Computers and Technology, 24.06.2019 10:20, savyblue1724707
Identify the publisher in this citation: carter, alan. a guide to entrepreneurship. new york: river’2008.print.
Answers: 3
You know the right answer?
Mergesort3: your friend suggests the following variation of mergesort: instead of splitting the lis...

Questions in other subjects:

Konu
Spanish, 08.01.2021 02:00
Konu
Mathematics, 08.01.2021 02:00
Konu
English, 08.01.2021 02:00