Investigacion

Páginas: 2 (276 palabras) Publicado: 6 de diciembre de 2010
! Definicion de variables
INTEGER vector(25)
INTEGER i, j, temp, izq, der, medio, valor, posicion
logical encontrado

PRINT *,"-----------------------------------------------------"
PRINT *, "- REPUBLICA BOLIVARIANA DE VENEZUELA -"
PRINT *, "- MINIST DEL PODER POP. PARA LA EDUCACION SUPERIOR -"
PRINT *, "-INSTITUTO NUEVAS PROFESIONES -"
PRINT *, "- AREA : INGENIERIA -"
PRINT *, "- CARRERA : COMPUTACION -"PRINT *, "- ASIGNATURA : PROYECTOS DE INFORMATICAS -"
PRINT *, "- PROYECTO: ARREGLOS Y MATRICES -"
PRINT *, "--"
PRINT *, "- INTEGRANTE: -"
PRINT *, "- RODRIGUEZ JENNY C.I: 10.471.409 -"
PRINT *,"-----------------------------------------------------"
PRINT *, " "

! Lectura de datos
16 PRINT *, "Introduzca los valores para ordenar:"
READ *, (vector(i), i=1,25)

! Ordenacion con elmetodo de la burbuja
DO i=1, 25-1
DO j=i+1, 25
IF (vector(j)<vector(i)) THEN

! se intercambian vector(i) y vector(j)
temp = vector(j)
vector(j) =vector(i)
vector(i) = temp
END IF
END DO
END DO

!se realiza la busqueda binaria en el vector dado
print *, "ingrese el Valor a buscar"
read *, valorencontrado=.false.
posicion=-1
izq=1
der=25
do while ((.not. encontrado ).and.(izq<=der))
medio=(izq+der)/2
if (vector(medio)==valor)then
posicion=medio
encontrado=.true.
else
if (vector(medio)>valor) then
der=medio-1
else
izq=medio+1
end if
end if...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Investigacion
  • Investigacion
  • Investigacion
  • Investigacion
  • Investigacion
  • Investigacion
  • Investigacion
  • Investigacion

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS