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
You can certainly do it in O(N) time, N being the number of items in your array:
Additional memory requirement is N+1 bits, which certainly beats any data structure that actually stores all N names.