go to previous page   go to home page   go to next page

Answer:

Yes. If you know that the tails are equal, all you need to do is check the first character.


A Tail of Two Strings

Is the string "" equal to the string "" ?

Yes

It may seem odd to worry about whether two empty strings are equal, but this needs to be done.

Is the string "" equal to the string "whatever" ?

No

Is the string "whatever" equal to the string "" ?

No

Is the string "A.....tail...." equal to the string "X.....tail...." ?

No

Is the string "A.....tail...." equal to the string "A.....tail...." ?

Yes — if the tails of the strings are equal.
No — if the tails of the strings are NOT equal.

QUESTION 16:

When using these rules, how do you decide if the tails of two strings are equal?


go to previous page   go to home page   go to next page