Documentos de Académico
Documentos de Profesional
Documentos de Cultura
5 2 Dicotomica en Archivos
5 2 Dicotomica en Archivos
VAR
a : file of integer;
num, numi, numj, valor, i, j, aux, inf, sup, med : integer;
band : boolean;
CARGA
if not eof(a)
V
DICOTOMICA
ORDENA
reset (a)
readln (valor)
for I := 0 to filesize(a)-2
reset (a)
sup := filesize(a)-1
seek (a , i)
inf :=0
read (a , numi)
band := false
seek (a , j)
read (a , numj)
seek ( a , med)
F
read ( a , num);
seek (a, i)
num = valor
write (a , numj)
seek (a , j)
band:= true
write (a , numi)
sup := med - 1
V
inf := med + 1
valor = num
writeln
('encontrado', MED,
es la posicion)
writeln
('NO esta en el archivo')