0

Write a program to count repetation of name's of students in a classroom

There are n no. Of students in a classroom and all are said to stand in a straight line and they randomly arrange themselves in a straight line. You are allowed to ask their name in a sequence from student 1 to n and multiple students have the same name. Write an algorithm to print the name in the same order which they occur as u ask them. Also provide the complexity of your algorithm in Big o notation. Sample Input N=9 Alok, amit, suresh, amit, vidhya, sindhu, vidhya, vidhya, alok Output Alok-2 Amit-2 Suresh-1 Vidhya-3 Sindhu-1

26th Nov 2020, 1:50 PM
Samir Imtiaz
Samir Imtiaz - avatar
3 Respuestas
+ 6
Ok first show us your attempt if you get any errors then we can help
26th Nov 2020, 1:56 PM
Piyush
Piyush - avatar
+ 1
Hint: use a dictionary with names as keys
26th Nov 2020, 2:13 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
Can any one please help me with the complexity in this https://code.sololearn.com/cG7V2YegxsVR/?ref=app
27th Nov 2020, 6:26 PM
Samir Imtiaz
Samir Imtiaz - avatar