I think Java changed treatment of substrings in one of Updates (was it 1.7.6?) 
before that when you get a substring from string, you would get a new string 
entity which references the original memory location. This seems logical, 
because string is immutable and to avoid unnecessary copying Java just 
initiated structure with reference to original memory location.

It changed in 1.7.6 where substring function really started to create separate 
string and perform copy operation.

Source of information is Robert Sedgewick in his Algorithms Part II course. He 
seemed annoyed with the change. Mostly because it does affect running time of 
many algorithms - you can't anymore assume that substring is O(1), which it was 
before change.

The only purpose of me writing it here is to ask if you know about that and if 
your solution is affected by this change? Also you can check which exact 
version of Java you are running.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-code/-/B-r7guLh5Q4J.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to