I can think of a number of ways to make a crossword generator, but I'm not sure about that second qualification. Here's an article which talks about making a crossword puzzle, and it links to one written in C, which has the source if you want to look at it (if you can't read C, I only spent a short time looking so I'm positive there's something else out on the net, you'll just have to look).

But getting the least amount of blank spaces is a tough one for me. I know there's a way to do it, I just can't think of it right now. Sorry, but I hope that helps.

I should clarify, by blank spaces you mean the unused squares and you want the words to intersect as often as possible and use the space in the most efficient way, right? Because the only way I can think to do that would be brute-force, and that generator written in C does just that. But brute-force is probably not what you want, because that could take a very very long time. The article I linked you to even touches on that a little, but he doesn't mention how he solved it.

The best advice I could give you would be to try and find as many examples and bits of source code of crossword puzzle generators as you can find and look at how other people did it. I think this is one of those deceptively difficult problems, so you might want to find something else to try if you don't think you're up for the challenge. Otherwise, I wish you the best of luck!

Years ago I wrote a word search puzzle generator in GW-Basic ( Did I say Many Years Ago ). Both a Crossword puzzle and word search are simular so Here is what I did, This May Help you. Let me know if it does....
First - You are going to need a large list of words with a set of clues. Example :
Apple
Clue 1 = Edible Fruit
Clue 2 = Grows on Trees
Clue 3 = Forbidden in the Garden of Edan
Get the idea.
Here I would create a stand alone program to enter and store this information, I would also include a small list of catagories attached to each word since most crosswords are theme based.
Next generate a 2 dimentional array to hold each letter of each word. (13,13) is a common size
Have the program start filling in the array. Then search for words that cross fill in the array. searching through each word to makesure it fits. I would use a number in the next subscript to indicate a noletter tile.
This would be a hefty challenge from scratch. Good Luck.