Question: I am new to iphone development.I want insert my xml parsed contents into a sqlite3 database and retrieve it and display it in a tableView.I am able to parse and directly display the contents using nsxml parser.Please help me how to proceed to store the contents in a database and retrieve it .Thanks.

Answer: 
THIS SOLUTION IS WRITTEN IN C++ BUT THE PRINCIPLE IS THE SAME

If your puzzle is represented by

```
char puzzle[N][N]

```

declare the arrays

```
int xd[8] = { -1, -1,  0, +1, +1, +1,  0, -1 };
int yd[8] = {  0, -1, -1, -1,  0, +1, +1, +1 };

```

and then when you want to check if word 'w' can be found at location (x, y) in direction d (d between 0 and 7 inclusive), just do

```
bool wordsearch(const char *w, int x, int y, int d) {
  if (*w == 0) return true; // end of word
  if (x<0||y<0||x>=N||y>=N) return false; // out of bounds
  if (puzzle[y][x] != w[0]) return false; // wrong character
  // otherwise scan forwards
  return wordsearch(w + 1, x + xd[d], y + yd[d], d); 
}

```

And then the drivers

```
bool wordsearch(const char *w, int x, int y) {
  int d;
  for (d=0;d<8;d++)
    if (wordsearch(w, x, y, d)) return true;
  return false;
}

bool wordsearch(const char *w) {
  int x, y;
  for (x=0;x<N;x++) for(y=0;y<N;y++) if (wordsearch(w, x, y)) return true;
  return false;
}

```
Keep first letters of each word your looking for in a list or some such data structure. Search every letter in order. If it is the first letter of a word you're searching for, then search every letter around it for a second letter. If you find a second letter in a word then note the direction in a word object that has a direction enum, i.e. {N = 0, NE, E, SE, S, SW, W, NW}. Then simply follow that direction until you have determined the word isn't found or is found. They key is for the search object to know how many words it's looking at. So if you're looking for both cater and cattle, if you find C-A-T going northeast, it could be either. Also, if you find an F you will need to make sure to check every direction because you can have FRIAR going east and FAT going west. Then it's as simple as making sure you don't go out of bounds because NE is X+1 Y-1, etc...