Analyze running time of algorithm

Assignment Help Computer Engineering
Reference no: EM132998

Question

Suppose you have an array of numbers, where each value occurs at most twice.

We consider sums of contiguous numbers in array. But we only consider such sums whose two endpoints have the similar value. The sum includes the 2 equal values themselves. So if the two equal numbers are at index i and index j (i < j) in array A, then we sum all the values A[i],A[i + 1], . . . ,A[j].

(a) Give an algorithm that finds maximum such sum. Make your algorithm as efficient as possible. Explain the algorithm briefly in English and in psuedo code.

(b) Analyze running time of your algorithm.

Reference no: EM132998

Questions Cloud

Prepare a computer credit memo : Prepare a computer credit memo that reduces the customer's account balance by the same amount
How to utilize data mining tools and techniques : How to utilize data mining tools and techniques
Discuss the importance of organisational culture : Discuss the importance of organisational culture for effective organisational performance. Support your answer with relevant industry examples
Classify traditional grade school algorithms : Classify traditional grade school algorithms
Analyze running time of algorithm : Analyze running time of algorithm
Explain briefly how electronic money works : Explain briefly how electronic money works. Give two benefits of e-money to each of the following-
What is compensation of using rule sets : What is compensation of using rule sets
What are the roles of the management sponsors : What are the roles of the management sponsors
Illustrate the constraint graph : Illustrate the constraint graph

Reviews

Write a Review

Computer Engineering Questions & Answers

  Explain in details what are structures

Explain in details what are structures.

  What is mno

What is MNO.

  Prove correctness for following

Prove correctness for following

  How to find the number of characters in a string

How to find the number of characters in a string

  How to make an xml file in visual studio

How to make an xml file in Visual Studio

  Explain fast process of distributing the cards to accountant

Explain fast process of distributing the cards to accountant.

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  How to plan a wan network linking a toy manufacturing plant

How to plan a WAN network linking a toy manufacturing plant? Plan a WAN network linking a toy manufacturing plant (located in Dallas Texas) with two division centres (Los Angeles, California and Pittsburgh, Pennsylvania)

  How to store ten floating-point values into vector

How to store ten floating-point values into vector. Write down a program that declares a vector of ten floating-point values

  Recognize how to locate fsmo roles

Recognize how to locate FSMO roles?

  What is microprocessor - motorola 68k assembly language

What is microprocessor - Motorola 68k assembly language? Implement your plan using a user vectored interrupt number 3. Use busy line from the printer to trigger the interrupt. The printer interrupt level is 2. Explain the extra hardware to make t..

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

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