Computer Science, asked by nishalakra1161, 9 months ago

find a pair in an array of size 'n', whose sum is x in c++

Answers

Answered by Anonymous
1

Given an array A[] and a number x, check for pair in A[] with sum as x. METHOD 1 (Use Sorting) Algorithm : Time Complexity: Depends on what sorting algorithm we use. If we use Merge Sort or Heap Sort then (-)(nlogn) in worst case. METHOD 2 (Use Hashing) This method works in O(n) time.

PLEASE MAKE ME AS A BRAINLIST ANSWER

Similar questions