Given an array of strings, you need to sort it using "qsort" function provided by C. You can use the "strcmp" function provided by the C language as well. #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) int main() { char *arr[]={"abc","def","abcd"}; int i; /* * code to sort.. *... *... */ for(i=0;i < SIZEOF(arr);i++) printf("%s\n",arr[i]); }
Here is a game one can buy in most toy stores. It's called Hi-Q (or Brainvita). 32 pieces are arranged on a board as shown below: X X X X X X X X X X X X X X X X o X X X X X X X X X X X X X X X X * Only the centre position is unoccupied. * A piece is allowed to move by jumping over one of it's neighbours into an empty space. * Diagonal jumps are not permitted. * When a piece is jumped over, it is removed from the board. Write an algorithm which determines a series of jumps so that all of the pieces except one are eventually removed, and the final piece ends up at the center position.