I want to do a ternary search for integers in C ... I have tried it...but it\'s not working well for particular cases. Please help me to remove the bugs from the following progr
The midpoint calculations are wrong. The way you have it, m1 and m2 are not between i and j.
try
m1 = i + (j - i) * 1 / 3; m2 = i + (j - i) * 2 / 3;