tag:blogger.com,1999:blog-694855878384792308.post8011402657769341202..comments2022-05-23T21:24:05.469-07:00Comments on Java67: Insertion Sort Algorithm in Java with Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-694855878384792308.post-10025390771103071462015-09-16T03:45:40.671-07:002015-09-16T03:45:40.671-07:00"Math.random() which returns a double value b..."Math.random() which returns a double value between 0.0 to 0.1"<br />should be 0.0 to 1.0, because 0.0 <= Math.random() < 1.0<br /><br />"objArray[j - 1].compareTo(objectToSort) > 1"<br />very likely should be " >0 ", because any positive value returned from compareTo is consider that o1 is greater than o2.<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-86518188106163689682014-12-11T22:49:54.749-08:002014-12-11T22:49:54.749-08:00Bubble Sort, Insertion Sort and Selection sort are...Bubble Sort, Insertion Sort and Selection sort are best left for academics. In today's heavy data age, they don't have any practical usage. Today we are looking for sorting algorithm which can sort millions of records in few micro seconds. On this point, Samsung has just release an algorihtm to sort tera bytes of data in few seconds. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-29968723890771201122014-09-25T08:44:12.837-07:002014-09-25T08:44:12.837-07:00In one of the interview, I was asked exactly this ...In one of the interview, I was asked exactly this question "Given an array of N values, arrange them into ascending order using insertion sort", and guess what, I have coded "selection sort", came home happy without realizing that I have been doing it completely wrong, and only realized in night :).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-45605650347124284382014-09-23T08:40:12.606-07:002014-09-23T08:40:12.606-07:00Insertion sort is next simple algorithm after infa...Insertion sort is next simple algorithm after infamous Bubble Sort. In my opinion this is the human's way of sorting things in order. You would have definitely used Insertions sort before without even realizing that you are using it, remember how do you arrange your hand in playing card came? Yes, that is Insertion sort. In this article, we will learn how to code Insertion sort in Java. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.com