java - Find duplicates in unsorted string array - O(nlogn) -
i got array of string hash values, example: "123-51s-12as-dasd1-das-41c-sadasdgt-31". need find out if there duplicates. catch is, need find them in o(nlogn).
1) idea:
to use binary-search algorithm. binary-search works sorted numeric array. ask: there way sort string array ?
2) open other answers. question is: how find duplicates in array of unknown strings - nlogn.
since time bound nlog(n)
, safely first sort array, , scan left right check duplicated strings.
Comments
Post a Comment