International Conference on Information and Communication Technologies |
Foundation of Computer Science USA |
ICICT - Number 7 |
October 2014 |
Authors: Surabhi Patel, Moirangthem Dennis Singh, Chethan Sharma |
be6cbb7d-ac18-43fb-8d8b-90a14a9a9177 |
Surabhi Patel, Moirangthem Dennis Singh, Chethan Sharma . Increasing Time Efficiency of Insertion Sort for the Worst Case Scenario. International Conference on Information and Communication Technologies. ICICT, 7 (October 2014), 21-23.
Insertion sort gives a time complexity of O(n) for the best case. In the worst case where the input is in the descending order fashion, the time complexity is O(n2). In the case of arrays, shifting takes O(n2) while in the case of linked lists comparison comes to O(n2). Here a new way of sorting for the worst case problem is proposed by using arrays as data structure and taking more space. 2n spaces is taken where n is the number of elements and starts the insertion from (n-1)th location of the array. In this proposed technique the time complexity is O(nlogn) as compared to O(n2) in the worst case.