0 votes 0 votes Consider an array contains n integers, each integer belongs to {-1, 0, 1}. What is the best case time complexity to sort an array? Algorithms sorting time-complexity array + – Rohan Mundhey asked Nov 9, 2016 • retagged Jun 20, 2022 by makhdoom ghaya Rohan Mundhey 501 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
2 votes 2 votes Apply one pass to count number of 1, 0, -1 hen in second pass do fillling -1 first then 0 then 1. SO O(n) time. Prashant. answered Nov 9, 2016 Prashant. comment Share Follow See all 0 reply Please log in or register to add a comment.