How do you solve this [1,5,9,4] pair numbers problem? So given an array of [1,5,9,4], find all pairs of numbers that can sum/subtract/divide/multiply to another number in the array(that number is not part of the pair), and return the total count of pairs satisfying this condition. (If a pair has 2 math operators that fit to the same number or if a pair can combine to 2 different numbers, dont count it twice). 

How do I start this? and how do I explain my asymptotic complexity(Im a noob wit this)?
This can be done in $O(n^2 \space log \space n)$.


Insert all N array elements with the indexes into a balanced BST.
For every $i \in \{0,...N-1\}$
For every $j \in \{0,...N-1\} \space and \space j \ne i$
Search for $(A[i]+A[j]),(A[i]-A[j]),(A[i]*A[j]),(A[i]/A[j])$ in the BST and add $(A[i],A[j])$ if it is found in the BST and  its corresponding BST entry $index \ne i\space and \space j$

Steps 1 and 2 runs for $O(n)$ time.
Step 2 runs for $n-1$ times = $O(n)$.
Step 3 runs for $4*log\space n = O(log\space n)$.
Hence, time complexity is $O(n^2\space log \space n)$.