title: Is it possible to have quadratic time complexity without nested loops?
body: <p>It was going so well. I thought I had my head around time complexity. I was having a play on codility and used the following algorithm to solve one of their problems. I am aware there are better solutions to this problem (permutation check) - but I simply don't understand how something without nested loops could have a time complexity of O(N^2). I was under the impression that the associative arrays in Javascript are like hashes and are very quick, and wouldn't be implemented as time-consuming loops. </p>
  
  <p>Here is the example code</p>
  
  <pre><code>function solution(A) {
      // write your code in JavaScript (Node.js)
      var dict = {};
  
      for (var i=1; i&lt;A.length+1; i++) {
          dict[i] = 1;
      }
  
      for (var j=0; j&lt;A.length; j++) {
          delete dict[A[j]];
      }
  
      var keyslength = Object.keys(dict).length;
      return keyslength === 0 ? 1 : 0;
  }
  </code></pre>
  
  <p>and here is the verdict</p>
  
  <p><img src="https://i.stack.imgur.com/2HvXp.jpg" alt="result"></p>