please tell me any good algorithm/code to get list of unique values from array and count of its occurrence in array. (i am using javascript).
Use an object as an associative array:
var histo = {}, val;
for (var i=0; i < arr.length; ++i) {
val = arr[i];
if (histo[val]) {
++histo[val];
} else {
histo[val] = 1;
}
}
This should be at worst O(n*log(n)), depending on the timing for accessing object properties. If you want just the strings, loop over the object's properties:
for (val in histo) {...}