Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Q1. You are given a one dimensional array that may contain both positive and negative integers. Give an O(n log n) algorithm to find the sum of contiguous (ie. next to one another, in sequence) sub-array of numbers which has the largest sum. For example, if the given array is [-2, -5, 6, -2, -3, 1, 5, -6], then the maximum sub array sum is 7 (the sub array is marked in boldface). Argue that your algorithm is correct.

You get as input n distinct positive integers a1, . . . , an. Give an O(n log n) algorithm to count the number of pairs i < j where ai > 2aj.

Q2. You are given two arrays, A and B, each of which contains n integers. The elements in each array are guaranteed to already be in sorted order in the input, i.e.

A[0] ≤ A[1] ≤ . . . ≤ A[n - 1],

and also

B[0] ≤ B[1] ≤ . . . ≤ B[n - 1].

Give as fast an algorithm as you can for finding the median value of all the 2n numbers in both A and B. (We define the median of 2n numbers to be the average of the nth smallest and nth largest values.) Argue that your algorithm is correct and give its running time.

Q3. You are given an array X of n elements. A majority element of X is any element occurring in more than n/2 positions. The only access you have to the array is to compare any two of its elements for equality; hence you cannot sort the array, etc. Design an O(n log n) divide-and-conquer algorithm to find a majority element in X (or determine that no majority element exists).

Q4. You are given a 2k x 2k board with one missing cell. Give an O(22k)-time algorithm for filling the board with "L-shaped" tiles. (See Figure 1 below.)

371_Figure.png

5. Consider you get as input a very sparse undirected weighted graph G = (V, E), in particular for which [E] - [V] = 20. Give an O(|V|) time algorithm for finding a minimum spanning tree on G and prove your algorithm correct.

Note - Question 1 has 2 different separate questions (Part A and B) with 2 different solutions.

Computer Engineering, Engineering

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

Have any Question?


Related Questions in Computer Engineering

1 the reliability of a hard-disk drive is typically

1. The reliability of a hard-disk drive is typically described in terms of a quantity' called mean time between failures (MTBF). Although this quantity' is called a "time, " the MTBF actually is measured in drive-hours p ...

A chemistry student needsnbsp550 gnbspof dimethyl sulfoxide

A chemistry student needs 55.0 g of dimethyl sulfoxide for an experiment. By consulting the  CRC Handbook of Chemistry and Physics , the student discovers that the density of dimethyl sulfoxide is 1.10 g.cm^-3. Calculate ...

In a nationwide poll of 1500 randomly selected us residents

In a nationwide poll of 1500 randomly selected U.S. residents, 77% said they liked pizza. In a poll of 1500 randomly selected U.S residents one month later, 75% responded they liked pizza. a. Does the polling evidence su ...

Question suppose a wireless channel has a coherence

Question : Suppose a wireless channel has a coherence bandwidth of 100 kHz. What range of bit rates can be supported to have flat fading? The response must be typed, single spaced, must be in times new roman font (size 1 ...

Question describe and discuss at least two backup

Question: Describe and discuss at least two backup strategies. Discuss the use of cloud backup strategies, as well? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow the ...

What decimal number does the bit pattern 0xc0d40000

What decimal number does the bit pattern 0xC0D40000 represent if it is: A two's complement integer An unsigned integer A floating point number assuming the IEE 754 single precision format Please provide a detailed explan ...

This is sports data analysis with python classone way to

This is sports data analysis with python class. One way to judge a basketball lineup is to determine the point differential when that particular combination of players is in the game - in other words, how many points doe ...

In thenbspworkspaceproject-lognbspdirectory create file

In the ~/workspace/project-log directory, create file named  changelog.txt  with the following content and format: Changelog Version: 1.0 Redirect the output of the ls command to a file named  file-list.txt  in the ~/wor ...

Explain how financial leverage at investment banks differed

Explain how financial leverage at investment banks differed from financial leverage at more traditional commercial banks. What is the benefits of this leverage? What are the primary risks associated with financial levera ...

The contracts manager at a company needs to make a large

The contracts manager at a company needs to make a large legal document available to an overseas customer. However, she has some challenges: The document contains sensitive information; it is too large to send via e-mail ...

  • 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