Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment sheet

1. Give an O(n2) algorithm to find the longest monotonically increasing subsequence of a se- quence of n numbers. (Example: given the sequence 4,8,5,7,2,9,10,1 your algorithm should output 4,5,7,9,10.)

2. Describe an O(n) time algorithm that, given a set S of n distinct numbers and a positive integer k ≤ n, determines the k numbers in S that are closest to the median of S.

3. Let X[1..n] and Y [1..n] be two arrays, each containing n numbers already in sorted order. Give an O(log n) time algorithm to find the median of all 2n elements in arrays X and Y.

4. Consider two sets A and B, each having n integers in the range from 0 to 10n. We wish to compute the Cartesian sum of A and B, defined by

C = {x + y : x ∈ A, y ∈ B}.

Note that the integers in C are in the range 0 to 20n. We want to find the elements in C and the number of times each element of C is realized as a sum of elements in A and B. Show that the problem can be solved in O(n log n) time.

5. We are given 2 positive integers a = (an-1an-2 . . . a0) and b = (bn-1bn-2 . . . b0), of n bits each, as 2 arrays A[1..n] and B[1..n], respectively. The MSB of a, that is an-1, is stored in the location A[1] and so on. Similarly with b. Give an O(n log n) algorithm to compute the array C[1..2n] that holds the integer ab (the product of a and b) in binary.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91940592

Have any Question?


Related Questions in Computer Engineering

Q2 what layer uses encryptiondecryptiona what is

Q2. What layer uses encryption/decryption? a. What is encryption? Q3. What addressing system is used at Data Link layer? a. How long is the address? Is it Physical or logical? b. Is it unique or not unique?

Question suppose user process application p1 of one

Question : Suppose user process (application) P1 of one computer wishes to transfer data (file) to process (application) P2 on another computer in the Internet. What addressing information about P2 is necessary for P1 to ...

Question state the dilemma the score as he puts it harnish

Question : State the dilemma ("the score", as he puts it) Harnish finds between the Humean view and the Frege-Russell view of representation. Do you think a computational theory of mind is a viable alternative to these v ...

Sorted golf scoresdesign a program that asks the user to

Sorted Golf Scores Design a program that asks the user to enter 10 golf scores. The scores should be stored in an Integer array. Sort the array in ascending order and display its contents. Looking for psuedocode format & ...

A small sports club keeps information about its members and

A small sports club keeps information about its members and the fees they pay. The secretary wants to be able to record when members pay and print a report similar to that in the figure below. last n me - first_narne - p ...

Listen to or read the transcript of this podcast

Listen to (or read the transcript of) this podcast (https://www.stlouisfed.org/education/economic-lowdown-podcast-series/episode-16-elasticity-of-demand) from the Federal Reserve Bank of St. Louis. describe your experien ...

Qestion what is your understanding of the term computer

Question: What is your understanding of the term "computer"? Why do we call it computer? Is that what it does? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow the APA ...

Question 1 explain the various types of green architecture

Question: 1. Explain the various types of Green architecture within the enterprise, such as information architecture and solutions architecture. 2. Explain how a Green systems architecture evolves from a basic to a linea ...

Research one job and company that interests you one that

Research one job and company that interests you, one that you think might be a good fit for you after graduation. i.Identify why that job and company is a good fit for you Prepare a cover letter for that job. i.Include y ...

Suppose i am designing a personnel database for a

Suppose I am designing a personnel database for a university. The university has three types of personnel: students, staff, and faculty. Here are the characteristics of the three groups: -All three groups have a name and ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As