here are n students in the classroom. They are asked to stand in a straight line and they randomly arrange themselves in a straight line. You are allowed to ask the student their names in a sequence from student 1 on to student n and multiple students can have the same name. Write an algorithm to print the names and the count of the same name in the same order which they occur as u ask them. Brute Force solutions will be rejected please attempt with more efficient solutions and provide the Complexity of your solution using Big O notation.
For Example
n=9
Alok, amit, suresh , amit, vidya, sindhu, vidya, vidya, alok
Output:
Alok -> 2
amit -> 2
suresh -> 1
vidya -> 3
sindhu -> 1
Answers
Answered by
0
Answer:
Thanks for free points
Similar questions