We have $2n$ values $x_1,x_2,x_3,\ldots,x_n$ and $y_1,y_2,y_3,\ldots,y_n$ such that the pair $(x_i,y_i)$ represents the location of a city $i$. Assume there is no straight line that goes through all the cities.
We also have the $n$ values $z_1,z_2,z_3,\ldots,z_n$. $z_i$ represents the population of the city $i$.
Our goal is to find three cities $a,b,c$ who are not a straight line (meaning, they form a triangle) with the largest population.
The question is as follows:
Propose a greedy algorithm that solves this problem. Prove the correctness of the algorithm, and find its time complexity.
What I did
The naive greedy algorithm that comes to mind is: pick the city with the largest population $a$, then pick the city with the second largest population $b$. Remove $a,b$ from the list of cities.
$(*)$Now from the remaining cities, choose $c'$ the city with the largest population. does $c'$ form a triangle with $ab$? If yes, then define $c=c'$ and stop. If no, then remove $c'$ from the list of cities and repeat step $(*)$
This is a greedy algorithm, but I'm not sure how to prove that it is correct. I thought maybe induction is the way to go, and it's easy to see that this algorithm is correct when no $3$ cities are on a straight line. It's also easy to prove when $n-1$ cities are on a straight line. But I can't seem to prove the general case.