bleep
BAN USERIm sorry. I found the solution on SO but i wasnt very clear on how to do. Here is izomorphius' solution to the problem:
int greater_on_right[SIZE];
int smaller_on_left[SIZE];
memset(greater_on_rigth, 1, sizeof(greater_on_right));
memset(smaller_on_left, 1, sizeof(greater_on_right));
int n; // number of elements;
int a[n]; // actual elements;
int greatest_value_so_far = a[n 1];
int greatest_index = n 1;
for (int i = n 2; i >= 0; i) {
if (greatest_value_so_far > a[i]) {
greater_on_rigth[i] = greatest_index;
} else {
greatest_value_so_far = a[i];
greatest_index = i;
}
}
// Do the same on the left with smaller values
for (int i =0;i<n;++i) {
if (greater_on_rigth[i] != 1 && smaller_on_left[i] != 1) {
cout << "Indices:" << smaller_on_left[i] << ", " << i << ", " << greater_on_rigth[i] << endl;
}
}

bleep
October 26, 2012 You can do this in two iterations.
1. Iterate through the array once and make a note of the numbers which is lesser than the number on the right.
2. Iterate through the array again and make a note of the numbers which is greater than the number to its left.
Now the number (or numbers) are the numbers which are common to both these things.
Huffman coding is usually used when you need to transmit an alphabet (set of symbols, in this case the english alphabet) over a communication medium using binary numbers (usually) or a much smaller alphabet. Which is why i see doing huffman code as unnecessary, although its not wrong. And i was asked this question in a microsoft interview for the same position and they were looking for the same answer. :)
 bleep February 29, 2012To compress string you can use something called runlength coding. This makes use of the redunduncies (like repetitions in string) and compresses it.
for example:
if you have aaaabbbcddeeeeffff
it can compressed as \4a\3bc\2d\4e\4f.
the backslash is used as an escape sequence to denote that its a compressing element. you escape backslash in the original text with another backslash just like how you would do in c/c++.
you can do this in n steps. its a straightforward algorithm
Repjanistbennett, Blockchain Developer at AMD
I am JanisBennett working as a journalist, having years of experience in my career. I have covered various stories.Great ...
RepEdithJHarden, Random at Axiom Sources
Je suis un professionnel de la gestion des soins de santé avec 2 ans d'expérience en supervision d'établissements ...
Repsharoneruther, AT&T Customer service email at ABC TECH SUPPORT
I am Sharon, from Bethlehem USA. I am working as a Park naturalist in Sammy's Record Shack company. I ...
Java solution:
 bleep October 27, 2012