Currently, I've stored the strings into an array, and I've scanned the entire array for strings that start with the substring. ["stackoverflow", "stackunderflow"] If I search for "stack", I get both strings, as they both start with "stack". If I search for "stacko", I get one string, "stackoverflow".
However, this is really slow, so what would be a more efficient method and how would I implement it? Also, I've tried searching around, and a lot of people say a Trie would be a lot faster, but how would I implement one?