@Shashank:
from your code, i looked at this part.

for j=0 to m
sum2+=3^b[j]

i assumed 3^b[j] as power(3,b[j]);
==> (2,0,0,0) -> 9+1+1+1 && (1,1,1,1) => 3+3+3+3 & both equals 12. 
and.. i didn't understand what you meant by base here. did you mean 
anything else?
or did I miss anything?
(how can we prove mathematically in case if we don't find any example. and 
link will be highly appreciated.)

another point. the size of array in function in n.  O(n)
and the values in b[j] are not function of n. the values in b[j] could be 
some 2^n, meaning it takes O(N) time to calculate the power.
(2^n may not be practical.. but this should not be ruled out)

@Siddhardh: your solution works.. but
AVL tree is a self-balancing binary search tree right? and it implecitly 
does sort elements. 
and the questions asks us not to use any sorting.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/sYximOXWEz0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to