Computer Science, asked by smurde78, 6 months ago

write an algorithm for the software developer to find yhe count of character that are not repeated in the string​

Answers

Answered by gauri1082
1

Answer:

Method 1: HashMap and Two-string method traversals.

Approach: A character is said to be non-repeating if its frequency in the string is unit. Now for finding such characters, one needs to find the frequency of all characters in the string and check which character has unit frequency. This task could be done efficiently using a hash_map which will map the character to there respective frequencies and in which we can simultaneously update the frequency of any character we come across in constant time. The maximum distinct characters in the ASCII system are 256. So hash_map has a maximum size of 256. Now read the string again and the first character which we find has a frequency as unity is the answer.

Algorithm:

Make a hash_map which will map the character to there respective frequencies.

Traverse the given string using a pointer.

Increase the count of current character in the hash_map.

Now traverse the string again and check whether the current character hasfrequency=1.

If the frequency>1 continue the traversal.

Else break the loop and print the current character as the answer.

Explanation:

mark me brainlist ❤️

Answered by pramodyadav030499
0

Explanation:

ajajjaajajajajwwsjsjssjsejs

Similar questions