ankitapuri / DSA-guide

Trying to cover important DSA
MIT License
49 stars 113 forks source link

[feature-1] Added Find_pairs_with_given_sum. in CPP #241

Closed kiruba-r11 closed 3 years ago

kiruba-r11 commented 3 years ago

Related Issues

Closes: #233

Describe the changes you've made

I have completely implemented a CPP program that takes the input of array elements from the user and prints the true if aPair with given sum exists else prints false

Type of change

How Has This Been Tested?

This has been tested by generating a set of random inputs using a generator and verified the outputs manually.

Describe if there is any unusual behavior of your code(Write NA if there isn't)

NA

Checklist:

kiruba-r11 commented 3 years ago

@ankitapuri Please have a look at it

kiruba-r11 commented 3 years ago

@ankitapuri The problem works fine and I have tested it. I hope you would have entered the inputs in unsorted order, but the inputs for this question must be in sorted order to use the Two Pointer concept.

ankitapuri commented 3 years ago

image see this

kiruba-r11 commented 3 years ago

@ankitapuri It's correct, there are pairs with sum 5, that is 1,4 and 2,3. The question is to return true or false about whether a pair is found or not, and not to print the pair found.