Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

HW2: Lexicographic order in the case of a further tie

f
fernandoalonzi_ (270 points)
1 2 3
in HW2 by (270 points)
recategorized by
When comparing two strings in lexicographic order, should we also consider '  '? Because ord('  ') comes before the others and this means that if a string starts with '  ' compared to another that doesn't, it wins the comparison.
326 views
closed

2 Answers

Best answer
Ganni02 (4920 points)
1 2 15
by (4.9k points)
selected by
As part of the initial process, you would need to remove all white spaces, hence the ' ' should be ignored.
leonardo_13 (1540 points)
6 15 22
by (1.5k points)
Great answer.
s
saad rahman (560 points)
0 0 3
by (560 points)
"The number of non-space characters is, however, equal
for each sequence". I think it implies that we have to consider non-space characters as mentioned in the assignment.
a
angelaob (1190 points)
2 4 7
by (1.2k points)
I think it means that after removing possible white spaces and tabs, the number of characters becomes the same for every string