I have an array containing names of items.
I want to give the user the option to create items without specifying their name, so my program will have to supply a unique defau
Insert all of the existing names into a hash table. Repeat your loop, but make isAvailable check the hash table. Assuming a decent hash, it's O(nh) where h is the cost of evaluating the hash.