0 votes 0 votes given n elements merge them into one sorted list using merge procedure then what is the time complexity for this ? explain with example Algorithms sorting merge-sort time-complexity + – suneetha asked Nov 3, 2018 • retagged Jun 20, 2022 by makhdoom ghaya suneetha 437 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Hemanth_13 commented Nov 3, 2018 reply Follow Share Merge procedure takes O(n) To compare elements of two splits it will take O(n) i.e take element of one split and compare with element of other split and the process is continued for n elements 0 votes 0 votes Onika commented Nov 12, 2021 reply Follow Share To merge n elements in sorted manner, merge sort is used. So, TC=O(nlogn) Not O(n) because, there are n random elements not sorted. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes @suneetha Time complexity of Merge Sort is O(n*Log n) in all the 3 cases (worst, average and best) as merge sort always divides the array in two halves and takes linear time to merge two halves... 1. https://gateoverflow.in/16103/The-time-complexity-of-producing-a-sorted-list 2. https://gateoverflow.in/784/Gate-cse-2005-question-39 Awe111 answered Nov 12, 2021 Awe111 comment Share Follow See all 0 reply Please log in or register to add a comment.