How To Calculate Time And Space Complexity