When you deallocate an array using delete [] name, does this take O(N) time by looping through the array and deleting everything inside, or does this just delete the array itself?
When you deallocate an array using delete [] name, does this take O(N) time by looping through the array and deleting everything inside, or does this just delete the array itself?
Depends.
If there is a destructor for the type stored in name, then yes, each of those destructors are run, then the memory is deallocated. Assuming that destructor runs in O(1) time, this would be an O(N) process.
If it's a type that doesn't have a destructor (primitive types, for example) the memory will just be deallocated (presumably in O(1) time, though I don't see any standard guarantees relating to this).