I have spent lots of time trying to find a complete explanation about the manner to define the time and space complexity of an algorithm and about what can i do when the time and space complexity are given and i should write the code corresponding to the restrictions , which i find very difficult. Please help me with a link to a good source.