tag:blogger.com,1999:blog-8779027097922009803.post2515455200780205736..comments2023-08-16T04:59:05.497-07:00Comments on Share your knowledge: Code puzzler: Tape EquilibriumAnonymoushttp://www.blogger.com/profile/08988603608690509267noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8779027097922009803.post-54502194373798289842016-03-05T06:13:52.459-08:002016-03-05T06:13:52.459-08:00Hi, Thanks for this great image that explores and ...Hi, Thanks for this great image that explores and helps me to understand what the Tape-Equilibrium is!.kaisernayanhttps://www.blogger.com/profile/05602194563597458132noreply@blogger.comtag:blogger.com,1999:blog-8779027097922009803.post-14475996066740456152014-01-30T02:20:23.119-08:002014-01-30T02:20:23.119-08:00Yeah.... arrays are a pain to work with... I proba...Yeah.... arrays are a pain to work with... I probably should convert the int array to a List first but even that takes a few lines of code extra... java does not autobox them unfortunately. But with a list I can easily take subLists.Anonymoushttps://www.blogger.com/profile/08988603608690509267noreply@blogger.comtag:blogger.com,1999:blog-8779027097922009803.post-73659096952393580842014-01-29T10:08:56.652-08:002014-01-29T10:08:56.652-08:00Well, my second point is incorrect if there may be...Well, my second point is incorrect if there may be negative ints.Ivan Lagunovhttps://www.blogger.com/profile/06646687524888275044noreply@blogger.comtag:blogger.com,1999:blog-8779027097922009803.post-38157689856679493042014-01-29T10:06:12.658-08:002014-01-29T10:06:12.658-08:00It has reminded me of the in-place version of quic...It has reminded me of the in-place version of quicksort algorithm: http://en.wikipedia.org/wiki/Quicksort#In-place_version<br /><br />BTW, a couple of improvements to your implementation:<br />1. You should avoid using Arrays.copyOfRange. It's so inefficient.<br />2. You can immediately break the loop as soon as the following becomes true: (difference > minDifference).Ivan Lagunovhttps://www.blogger.com/profile/06646687524888275044noreply@blogger.com