How can I find the coordinates of a triangle, given its area and perimeter? (I can find any triangle that satisfies the given area and perimeter.)
I tried to find the lengths of the sides of the triangle in the following way:
Consider the sides as $x, y, z$, altitudes as $p, q, r$, area as $A$ and half the perimeter as $s$.
Then, $px = qy = rz = 2A$ and $A=\sqrt{(s)(s-x)(s-y)(s-z)}$.
I will be computing this answer on my PC and for this method, the best time complexity I could think of is $O(n^{2}.log(n))$, where $n$ is the length of side.
How can I further reduce the problem further and also improve my solution for this problem?


You can't. You don't even have enough data to find the sides, as you have two equations in three unknowns. After that, you can translate and rotate the triangle without changing the area or perimeter, so you have (in 2D) three more unknown parameters.