title: Deleting a dynamic array of pointers in C++
body: <p>I have a question concerning deleting a dynamic array of pointers in C++. Let's imagine that we have a following situation:</p>
  
  <pre><code>int n;
  scanf("%d", &amp;n);
  Node **array1 = new Node*[n];
  /* ... */
  </code></pre>
  
  <p>where Node is a certain structure defined beforehand. Suppose that after allocation with the new operator, we change the content of the array1 (but we do not delete anything!). What is the proper way to delete the array1 and all its content if there is a possibility of repeated pointers in the array (without sorting them or inserting into the set, in linear time)?</p>