I want to track device using triangulation algorithm. It works fine with 3 BTS stations at 3 different locations. What should I do if only 1 or 2 BTS exists.
With less than 3 sources, you cannot identify the location uniquely. However, if you can put some constraints on the speed at which the device can move, you can use the previous location and dead reckoning to guess the current one.
See also the answer to this question: How to perform trilateration using 3 lat/lon points without distances?