Algorithm to decide whether there are 2 integers sum equal x

Assignment Help Data Structure & Algorithms
Reference no: EM13944157

Suppose you are given a set P of integers and another integer x. We wish to use a O(n*lg n) algorithm to decide whether there are 2 integers in P whose sum equals to x. Show your algorithm. You can use pseudo code or verbose description to explain your algorithm.

If you need to use any well known standard algorithm in your solution, you need not give details of that, just mention how that is helping you in devising solution for the given problem.

Note that there is no restriction on integers in set P and integer x, that is, we are not restricting ourselves to positive or negative integers.

Reference no: EM13944157

Questions Cloud

Probability distribution for the number of times : An office manager has several computers running distributed programs. Because of the demands on the system, the machines may crash at various times during the day and require a hard reset. The probability distribution for the number of times a ran..
What is the forecast cash position of jethro : What is the forecast cash position of Jethro Turnbull at the end of the budget year, assuming a current bank overdraft of £15,000?
Means and proportions for several groups : A marketing study conducts 60 significance tests about means and proportions for several groups. Of them, 3 tests are statistically significant at the 0.05 level. The study's final report stresses only the tests with significant results, not menti..
Modelling equation for tank height assuming : In Number 1 it was assumed that the input and output flow rates could be independently varied. Consider a situation in which the outlet flow rate is a function of the height of liquid in the tank. Write the modelling equation for tank height assum..
Algorithm to decide whether there are 2 integers sum equal x : Note that there is no restriction on integers in set P and integer x, that is, we are not restricting ourselves to positive or negative integers.
Social security long enough to be fully insured : Kate is a single parent who earns $40,000 per year. Her household expense are $28,000 per year.  If she were to die, she estimates that the costs of her death would be $10,000.  She has not participated in Social Security long enough to be fully insu..
Compare scholastic, and associationist viewpoints of reality : What are your thoughts on the content of this discussion below. How does this person interpret reality? Do you agree or disagree?
Discuss and define modigliani and miller capital structure : "Discuss and define Modigliani and Miller Capital structure irrelevance theory proposition 1 and 2 and state the difference it makes with tax and without tax "
Role of an entrepreneur of an organisation : Assume the role of an entrepreneur of an organisation that sells goods or services to the public. You would like to expand without the capital costs of establishing additional retail outlets and hay have decided to explore the possibility of expan..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Create long queue-customers dequeue to next counter

Write a program to simulate a grocery store checkout counter. Construct one long queue from which customers dequeue to the next available counter.

  Give time algorithm that outputs satisfying assignment

Find out  whether there is an assignment of true/false values to the literals such that at least a*m clauses will be true. Note that 3-SAT(1) is exactly the 3-SAT problem. Give an O(m*n)-time algorithm that outputs a satisfying assignment for 3-S..

  Question 1 describe the formal definition of an algorithm

question 1. what is the formal definition of an algorithm? question 2. define the three constructs used in

  Problem 1 n vehicles occupy squares 1 1 through n 1 ie the

problem 1. n vehicles occupy squares 1 1 through n 1 i.e. the bottom row of an n times n grid. the vehicles must be

  Sequential logic structures-flowchart or pseudocode

Document the steps for the logic structure to capture the payment information. This can be done as either a flowchart or pseudocode. Be sure to include inputs, variable declarations and assignments, and outputs.

  Plot six training points in a two-dimensional space

how many examples do we need to exhaustively enumerate every possible combination of inputs -  what is the conditional probability that An item classified as Reject is actually good?

  Why is understanding algorithm efficiency so critical

Why is understanding Algorithm Efficiency so critical?

  Operation when you use the quick union algorithm

Show the contents of the id array after each union operation when you use the quick union algorithm (Program below) to solve the connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3.

  Design algorithm based on bfs that colors a graph

Design an algorithm based on BFS that either colors a graph with 2 colors or determines that two colors are not sufficient.

  Design and implement an avl tree algorithm

Design and implement an AVL tree algorithm that searches a collection of documents. You will be provided with a set of 50 documents and a set of sample queries. First, you will process the documents and store their content (i.e. words / tokens) in..

  Describe a method for over tting-avoidance

Which would be chosen as the \best" attribute by a decision tree learner using the information gain splitting criterion and describe a method for over tting-avoidance in decision tree learning.

  What advantage can be gained by using worst fit algorithm

A third hole allocation scheme, in addition to best fit and first fit, is worst fit, where a process is allocated space from the largest remaning hole. What advantage can be gained by using the worst fit algorithm?

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