If given an algorithm to traverse a graph (say with a breadth first traversal algorithm). And say you code it in the same manner described in this video tutorial shows (starting at 04:30 for breadth first).
Then you were asked to do an Analysis of the correctness and complexity of the code. What things will you set your mind to think about in analysing the algorithm?
I mean let us start with Correctness Analysis .. is it simply a matter of setting my algorithm to work on 100s and 1000s of different graphs and if the traversal of all of them is a success I say "Yep, I have analysed this and it is correct!"
Or is there more to it? How would you analyse the correctness of a piece of code?
Also complexity .. there are so many parameters to complexity, but I'm guessing with it being an Algorithm, it'll be useful to talk about that n metrics stuff, n to the power of 2 and so on .. that is complexity is it not? The higher the power of n, the more complex the algorithm. How can I figure out the power of n for some code?
How do you determine the complexity of an algorithm?