These a reverse of binary search.... 1. iteration would be 1,2,4,8,16,32........... 2. ex. array a has the infinity 0's . Let it be n(very large) count=1; for(i=1;i<n; i=(2^count)) {if (a[i]==0) b[count]=1; }
to decrypt it for (i=0;b[i]!=0;i++) { print 2^i Zeros .... } here space complexity is reduced to o(log n ) from O(n)............... imagine n to be 2^100 , you require just 100 memory location to store them...... On Sep 15, 7:21 am, bittu <shashank7andr...@gmail.com> wrote: > A file is given with many 0s stored in continuous way , store it in > another file such that when you store try saving the space by using > minimum amount of space. When you want to create the original file , > you should be able to do so with the new file created -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.