The time complexity has to do with the critical opeations being performed. In your program the critcal operations are being execurted in the for loops. I am only getting you started. Like others have said, if you want to learn, you need to do your homework.