tag:blogger.com,1999:blog-8712770457197348465.post4582186433854885049..comments2024-03-28T02:47:19.159-07:00Comments on Javarevisited: Difference between a List and Array in Java? ArrayList vs Array Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-8712770457197348465.post-86691639931246722122019-07-02T23:58:08.125-07:002019-07-02T23:58:08.125-07:00Really Nice Explanation.
Thank you!!Really Nice Explanation.<br />Thank you!!Somanath K.noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-31139196036590779762017-04-06T23:38:08.134-07:002017-04-06T23:38:08.134-07:00If you enjoy following Javarevisited, you should c...If you enjoy following Javarevisited, you should checkout the Wellness Mama fan page. She's been publishing some awesome content you should consider liking her fana page<br /><br />shout-out-for-shout-out dealsAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-33111147931822537042017-01-09T12:41:18.132-08:002017-01-09T12:41:18.132-08:00Hi,
Success for this site.
Hi,<br /><br />Success for this site.<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-68097103943295733602016-01-27T09:13:32.766-08:002016-01-27T09:13:32.766-08:00Even if you are using System.arrayCopy, it is stil...Even if you are using System.arrayCopy, it is still O(N), it doesn't matter if it is Java/Ruby/Aseembly or you are using RAM, HD or CPU Cache, what matter is the algorithm used to copyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-52047644603901900532016-01-25T12:15:25.970-08:002016-01-25T12:15:25.970-08:00Type Safety statement is incorrect: You will get c...Type Safety statement is incorrect: You will get compilation error if you try to store the String in int array.Anonymoushttps://www.blogger.com/profile/09244594322178872012noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-44575663476510468792016-01-22T18:34:30.330-08:002016-01-22T18:34:30.330-08:00@Unknown, Yes, array copy is theoretically O(n) bu...@Unknown, Yes, array copy is theoretically O(n) but ArrayList.add() internally uses System.arrayCopy() to copy data. Since System.arraycopy() is a native call which does copy operation directly at memory, it's much faster than O(n). It also depends where you are adding element e.g. if you append it's constant or logarithmic but if insert it at the middle than it could be linear or (nlogn)javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-49865205664628316522016-01-22T08:15:33.689-08:002016-01-22T08:15:33.689-08:00> add can be O(logN) in ArrayList if adding a n...> add can be O(logN) in ArrayList if adding a new element triggers resize, as it involves creating a new array in background and copying elements from the old array to new array.<br /><br />Is it really O(logN)? Copying should take O(n)Anonymoushttps://www.blogger.com/profile/15224259712300684307noreply@blogger.com