Compute the matrix using the specific algorithm

Assignment Help Data Structure & Algorithms
Reference no: EM131568471

Question: Consider the following algorithm, which takes as input a sequence of n integers a1, a2,...,an and produces as output a matrix M = {mij } where mij is the minimum term in the sequence of integers ai, ai+1,...,aj for j ≥ i and mij = 0 otherwise.

procedure bit count (S: bit string)
count := 0
while S ≠ 0
count := count + 1
S := S Λ (S - 1)
return count {count is the number of 1s in S}

a) Show that this algorithm uses O(n3) comparisons to compute the matrix M.

b) Show that this algorithm uses (n3) comparisons to compute the matrix M. Using this fact and part (a), conclude that the algorithms uses (n3) comparisons.

[Hint: Only consider the cases where i ≤ n/4 and j ≥ 3n/4 in the two outer loops in the algorithm.]

Reference no: EM131568471

Questions Cloud

Recommend policies to avoid financial statement fraud : In this assignment, you will recommend policies to avoid financial statement fraud and ensure the quality of financial statements.
Memory principles and brain : Provide concrete examples of how they would use at least 3 of the memory principles listed below to be successful in college. Memory principles and brain
Analyze average-case performance of linear search algorithm : Analyze the average-case performance of the linear search algorithm, if exactly half the time the element x is not in the list.
Describe the determinants of health : Description of the communicable disease (causes, symptoms, mode of transmission, complications, treatment) and the demographic of interest.
Compute the matrix using the specific algorithm : Consider the following algorithm, which takes as input a sequence of n integers a1, a2,...,an and produces as output a matrix M = {mij }.
How are the companys assets classified : How are the company's assets classified? What are the company's total current liabilities at the end of its most recent annual reporting period?
Brief information about the providers and staff : Brief information about the providers and staff and contact information for the office manager, billing officer and patient educator.
Explain the basic structure of the typical corporation : Explain the basic structure of the typical corporation and how the shareholders own the company and elect directors to run it
Schizophrenia and other psychotic disorders : Do a high percentage of people with schizophrenia commit violent acts. What are the risk factors associated with those who do show violent behavior

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Write a concise summary about physical tamper-resistant

Write a concise summary (ideally one to two pages) of what you have learned about physical tamper-resistant devices.

  Implement the dictionary using a sorted array

COSC 2007 -Data Structures - Implement the dictionary using a sorted array. Here you will be required to implement find operation using binary search and Implement the dictionary using a sorted linked list.

  Show state of memory after processes by best fit algorithm

Using the best fit algorithm, show the state of memory after processes of 212K, 417K, 112K and 350K (in request order) arrive.

  Briefly describe why you think it would be easier

You are involved in a debate with other IT systems analysts. Some of the analysts believe it is harder for the experienced analysts to learn the object modeling technique since they are accustomed to data and process modeling. Briefly describe why..

  Definition of a method isreverse

Provide the definition of a method, isReverse , whose two parameters are arrays of integers of equal size. The technique returns true if and only if one array is reverse of the other.

  Develop a decision table and a decision tree

Purpose of this Assignment This assignment gives you the opportunity to apply the course concepts to develop a Decision Table and a Decision Tree for one aspect of the new billing and payment system

  Design a divide-and-conquer algorithm

Design a divide-and-conquer algorithm for the Motif Finding problem and estimate its running time. Have you improved the running time of the exhaustive search algorithm?

  Explain solution to recurrence-appealing to recursion tree

Solve the following recurrence relations by the method of your choiceT(n) = 1 for n = 4 and T(n) =pnT(pn) + n for n > 4. Argue that the solution to the recurrence T(n) = T(n=3) + T(2n=3) + cn is (n lg n) by appealing to the recursion tree.

  Discuss the issues involved in managing software selection

Prepare a PowerPoint presentation which summarizes the background, requirements, analysis and reasons for your choice. Alternative presentation formats such as Prezi are acceptable

  Implement your algorithm in python

The program should display the total sales, sales for each car type, total bonus, bonus contributed by each car type, additional bonus for each car type and grand total bonus.

  Code for a sequential search and a binary search

I have code for a sequential search and a binary search. I have to "add a counter for every key comparison in each search function and print out the number of key comparisons for each search."

  Explain an application level protocol

Create and explain an application level protocol to be used in an automatic teller machine and a bank's centralized computer. Your protocol should permit a user's card and password to be verified,

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd