06.05.2013 Views

ALGORITMOS DE BÚSQUEDA Y ORDENACIÓN

ALGORITMOS DE BÚSQUEDA Y ORDENACIÓN

ALGORITMOS DE BÚSQUEDA Y ORDENACIÓN

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ALGORITMOS</strong> <strong>DE</strong> <strong>BÚSQUEDA</strong><br />

EN ARCHIVOS SECUENCIALES<br />

TYPE<br />

tElem=record<br />

clave: tclave;<br />

resto de la información<br />

end;<br />

tarchivoelem=file of tElem.<br />

PROCEDURE buscar(var f:tarchivoelem;c:tclave;var<br />

elem:tElem; var encontrado:boolean);<br />

{Efecto. Si c está en f entonces encontrado=true y elem es el<br />

elemento buscado, en otro caso encontrado=false}<br />

Begin<br />

encontrado:=false;<br />

while not Eof(f) and not encontrado do begin<br />

read(f,elem);<br />

if c:=elem.clave then<br />

encontrado:=true<br />

end; {while}<br />

end; {buscar}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!