Asadullah Ansari

Build-Up Your Problem Solving Skill : Specially Using By C/C++/Data Structure Puzzles/New Technique Algorithm Design/ Understanding New Technology

Give the optimized algorithm for this?

Posted by asadullahansari on August 20, 2008

Suppose a number is given. You have to write an algorithm to find sum of two elements of a given array which should equal to a given number.

Example:
arr[]={ 2,5 ,7 ,9 ,4 ,6 ,8 }
a number give nSum= 17

then You have to find elements 9 and 8.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: