this is a yabasic programc;
try it on small size zip files ( like as of 1Mb ) to check its efficiency
then a serious programmer will enhance my program for professional use
dim t(100000000)
dim u(100000000)
dim v(1500)
i=1
open 1,"d:dummy.zip","rb"
open 2,"d:dummy1.txt","wb"
open 3,"d:dummy1_log.txt","w"
after each execution of the program, pack the file dummy1.txt which will label dummy1.zip, and then a dummy2.txt will appear
actually, I used this method on a 800 kb zip file which, after 15 executions, drops to 4 kb...
give it a try, I hope it will enlight your journey
while(!eof(1))
t(i)=peek(1)
i=i+1
rem print i
wend
close 1
20
print "pass 1..."
j=1
k=1
o=0
m=1
if (t(1)-128>=0) then
f=1
else
f=0
endif
while (j<=i)
rem print j,t(j)
zz=256
while (zz>1)
zz=zz/2
if (t(j)-zz>=0) then
40
f=1
else
f=0
endif
if (f=1 and o=0) then
k=k+1
u(k)=1
o=1
else if (f=1 and o=1) then
u(k)=u(k)+1
if (m<u(k)) then
m=u(k)
endif
t(j)=t(j)-zz
elseif (f=0 and o=0) then
u(k)=u(k)+1
if (m<u(k)) then
m=u(k)
endif
60
elseif (f=0 and o=1) then
k=k+1
u(k)=1
o=0
endif
endif
wend
j=j+1
wend
print "almost finished"
print m
for l=1 to k
poke #2,u(l)
v(u(l))=v(u(l))+1
next l
80
close 2
print "finish"
for m=1 to 1500
if (v(m)>0) then
print m,v(m)
r=r+m*v(m)
print #3,m,v(m),m*v(m)
endif
next m
print #3,r
close 3
end