Okay, so I wrote my own program. ITs basically an algorithm that takes in input, does a bunch of mathematical calculations, and returns an output.

Although, it takes my computer 10 minutes to calculate the solution! I dont understand why it is taking that long to do the calculations. I know it has nothing to do with my computer being slow. For example, Ive run a java chess playing program on my computer, which too implements a mathematical algorithm (if you know about computer chess) that calculates the best chess move. And the chess program (not writen by me) finishes the calculations fast. For 6 plies, it calculates the best chess move in 30 second stops.

The complexity of my program's algorithm is comparable to that of a computer chess program. Yet the chess program can get its solution in 30 seconds, and mine takes 10 minutes!! So Im thinking its not that my algorithm is a very long one, but rather Im doing something wrong in wiriting my code or something.

Again, I have no clue why my program is taking so long. Its not porforming rediculously long calculations (the algorithms calculations are comparable to that of a computer chess programs). Do you have to write your code a certain way to make it run faster? Am I supposed to thread my program (I dont use threading in my program)? how would using threads speed this up?
is there something Im missing?

please help.