I\'ve got a database with approximately 200 000 items, which is sorted by username. Now when I add an item to end of array and call my quick sort function to sort that array it
You can do binary search like this way.. Here You can assume that if val is string type then compare using string comparison function and int AR[] is set of string or You can map them to integer. As the array is sorted , I think binary search will give you the best performance.
int bsearch(int AR[], int N, int VAL)
{
int Mid,Lbound=0,Ubound=N-1;
while(Lbound<=Ubound)
{
Mid=(Lbound+Ubound)/2;
if(VAL>AR[Mid])
Lbound=Mid+1;
else if(VAL