title: How to determine memory and time complexity of an algorithm?
body: <p>I am not good at determining time and memory complexities and would appreciate it if someone could help me out.</p>
  
  <p>I have an algorithm, here and I am not sure what its time and memory complexities would be.</p>
  
  <pre><code>Function sample(k)
     IF k &lt; 2
         Return 0
     Return 1 + sample(k/2)
  </code></pre>
  
  <p>What is its time and memory complexity and why?</p>
  
  <p>Thanks</p>