subject

Let us consider an array a[1...n] with integer values (both positive and negative). Choose three different sorting methods to sort increasingly the array. Which sorting method is the fastest (from the three chosen methods)? Analyze the complexity (problem size, dominant operation and complexity) of the three algorithms in order to prove your answer. (1p) Now that your array a[1...n] is sorted increasingly, consider a value v and using an algorithm with complexity 0(lgn), determine the position where this value can be inserted such that the array remains increasingly sorted. Prove the total correctness of your algorithm (use an invariant). (1p)

Consider another increasingly sorted array b[1...m]. So now you have a[1...n] and b[1...m] with elements not necessarily distinct.

a. Construct a strictly increasingly sorted array with the distinct elements from a and b. Analyze the complexity (problem size, dominant operation and complexity) of your algorithm. (0.5p)

b. Propose an algorithm with linear complexity to determine the set with common elements of the two arrays a and b. Analyze the complexity (problem size, dominant operation and complexity) of your algorithm. (0.5p)

Indications:

All the algorithms will be written in pseudocode.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 00:40
What is the error in the following pseudocode? module main() call raisetopower(2, 1.5) end module module raisetopower(real value, integer power) declare real result set result = value^power display result end module
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
This assignment continues work on the online booking facility introduced at the end of chapter- 10. the work will be continued in the assignments for chapters 14 and 15 (a) assume that you will produce your online booking facility using an agile approach. i. suggest the kind of user research you would like to conduct for your product before iteration cycles begin. ii prioritize the requirements for your product according to business value, i.e which requirements are likely to provide the greatest business benefit, and sketch out the ux design work you would expect to undertake during the first four iteration cycles, i.e. cycle 0, and cycles 1 to 3. (b) using one of the mockup tools introduced above, generate a mockup of your product's landing page, as developed in the assignment for chapter-11 (c) using one of the patterns websites listed previously, identify suitable interaction patterns for elements of your product, and develop a software-based prototype that incorporates all the feedback and the results of the user experience mapping achieved at the end of chapter-11. if you do not have experience in using any of these, create a few html web pages to represent the basic structure of your website
Answers: 2
question
Computers and Technology, 24.06.2019 20:30
Does the query hawaiian photographers fully meets results?
Answers: 1
question
Computers and Technology, 25.06.2019 01:30
Ashort circuit locator should be periodically run along the cords used in a shop to check for shorts and open circuits. a.)true b.)false
Answers: 2
You know the right answer?
Let us consider an array a[1...n] with integer values (both positive and negative). Choose three dif...
Questions
question
Mathematics, 15.10.2019 21:00
question
Mathematics, 15.10.2019 21:00
Questions on the website: 13722360