al-go-rithms
al-go-rithms copied to clipboard
Two pointer technique
Two pointer technique is used to find two numbers from the given array whose sum is given. This Algorithm search the two number in n*log(n) time while brute force method does the same in n-square time. Since this algorithm is more efficient, it is more widely used in Competitive programming. If the given array is sorted it will take time of order n i.e. the size of input array.