1 1 vote What is the worst case time complexity to count pairs of numbers with difference ‘k’ from an input array of ‘n’ numbers? a) O(logn) b) O(nlogn) c) O(n^2) d) O(n^2logn) Algorithms algorithms time-complexity made-easy-test-series madeeasy-testseries-2018 + – charul 1.5k views answer comment Share Follow Print See all 10 Comments 10 10 Comments reply Show 7 previous comments Rohit Gupta 8 commented Jan 13, 2018 i edited by Rohit Gupta 8 Jan 13, 2018 reply Follow flag Use merge sort for sorting. In worst case O(nlogn) & O(nlogn) to find x-y = k. 0 0 replyShare vishal chugh commented Jan 13, 2018 reply Follow flag But what is the need to sort if Worst Case Time complexity is asked? 0 0 replyShare Rohit Gupta 8 commented Jan 13, 2018 reply Follow flag Worst case of best algo? 0 0 replyShare Please log in or register to add a comment.