Fichas
Sin título
Fichas del conjunto (1)
- 1Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?First question: which characters are we talking about? I'm assuming unicode. Which has more than 120,000 characters.
First thought: create an array that can hold binary values. All will initially be set to 0. Go thru the string and use the character as a key that maps to the array index. Check if the value is already 1. If not, update the boolean value to 1. If so, break out.
New idea:
Implement quick sort, and intercept the value check and merging. If two values are equal to each other, break out.
Pseudocode solution:
contains_unique_characters function ( string)
Checker is 0
Loop thru length of string
Información
- Descripción
- 101 Psychology Fichas sobre Sin título, creado por Lidza Louina el 14/10/2015.
- Creado por
- Lidza Louina
- Visitas
- 0
- Valoración