tag:blogger.com,1999:blog-6314876008291942531.post240127334010766322..comments2024-01-14T00:36:43.430-08:00Comments on Antonio Gulli's coding playground: Min difference in an array of integersUnknownnoreply@blogger.comBlogger1125tag:blogger.com,1999:blog-6314876008291942531.post-63547281882363921902010-07-19T16:34:34.096-07:002010-07-19T16:34:34.096-07:001) Sort the array using something like QuickSort o...1) Sort the array using something like QuickSort or Divide and Conquer [ O(nlgn) running time ]<br /><br />2) Walk thru' the array computing difference between two consecutive integers holding the minimum and the index [ O(n) running time].<br /><br />So effective running time is O(n lg n)Venkateshhttps://www.blogger.com/profile/15893132887136527161noreply@blogger.com