We are asked to implement an algorithm that checks if a string has unique characters, meaning there are no repeating characters.
Before we dig into the solution, we need to determine if we are working with an ASCII or Unicode string?
If we are working with ASCII then we only need to deal with only 128 unique characters and if we are working with Unicode we have to deal with 280 unique characters.
Let's assume we are dealing with an extended ASCII string, that can accommodate 256 characters.
We will be using the string “The Maths Geek” inside our array/list with an of 256, as we are working with extended ASCII.
To check each character in the string we need to make use of a Boolean array/list and set our default value to False.
After declaring our array/list we need to get the characters from the string and get a specific character. To achieve this we will be using the chars method and store it in an integer variable to get the ASCII value of that character.
After finding the ASCII value we will update the lists index location to True, the process is repeated in our loop with H,E,M,A,T,H,S,G,E,E,K .
Now if we have repeating characters we still store the ASCII value, check the index value again and if we find a repeating index location as it is already True we return False.
Moving on to the code implementation;