Karteikarten
Ohne Titel
Karten in diesem Stapel (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
Informationen
- Beschreibung
- 101 Psychology Karteikarten am Ohne Titel, erstellt von Lidza Louina am 14/10/2015.
- Erstellt von
- Lidza Louina
- Aufrufe
- 0
- Bewertung