Algoritmia - algoritmo de ordenacio shell

 
Vista:

algoritmo de ordenacio shell

Publicado por pepe (2 intervenciones) el 26/03/2001 20:16:15
necesito urgentemente el algoritmo del metodo de ordenacion shell.Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:algoritmo de ordenacio shell

Publicado por Diego Romero (9 intervenciones) el 27/03/2001 03:11:18
Algoritmo Ordenacion Shell (en turbo pascal).

procedure Shell (var elemento:array_de_datos; contador:integer);
const
t=5; {Cantidad de divisiones del Array}
var
i,j,k,s,m:integer;
h:array[1..t] of integer; {cada una de las celdas}
x:telemento_datos;
begin
h[1]:=9; {Arbitrario}
h[2]:=5;
h[3]:=3;
h[4]:=3;
h[5]:=1;
for m:=1 to t do
begin
k:=h[m]
s:=-k;
for i:=k+1 to contador do
begin
x:=elemento[i];
j:=i-k;
if s = 0 then
begin
s:=-k:
s:=s + 1;
elemento[s]:=x;
end;{if s}
while (x<elemento[j]) and (j>0) and (j<=contador) do
begin
elemento[j+k]:=elemento[j];
j:=j-k;
end;{while}
elemento[j+k]:=x;
end; {for i}
end;{For m}
end; {Shell}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:algoritmo de ordenacio shell

Publicado por ENRIQUE (1 intervención) el 31/05/2010 00:05:08
error 3 unknown identifier esoo me aparece =/ solucion?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:algoritmo de ordenacio shell

Publicado por Emilio (5 intervenciones) el 09/04/2001 14:22:30
Aqui esta el algoritmo que hice espero te sirva.

1 void shellSort(int a[],int l,int r)
2 {
3 int h;
4 for(h=1;h<=(int)(r-l)/9;h=3*h+1);
5 for(;h>0;h/=3)
6 for(int i=l+h;i<=r;i++)
7 {
8 int j=i;
9 int v=a[i];
10 while(j>=l+h&&less(v,a[j-h]))
11 {
12 a[j]=a[j-h];
13 j-=h;
14 }
15 a[j]=v;
16 }
17 }

18 boolean less(int a,int b)
19 {
20 return a<b;
21 }
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:algoritmo de ordenacio shell

Publicado por MARY (1 intervención) el 30/06/2008 21:37:39
QUIERO SABER COMO SE USA EL ALGORITMO SHELL DE LA FORMA MAS SENCILLA, POR FAVOR Y TAMBIEN UN EJEMPLO, ES QUE VOY A EXPONER DE ESTE TEMA Y QUIERO SABER COMO HACER TAMBIEN LA CORRIDA DE ESCRITORIO GRACIAS.
Y TAMBIEN LA HISTORIA DE EL ALGORITMO SHELL
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:algoritmo de ordenacio shell

Publicado por saintspy (3 intervenciones) el 05/05/2001 01:24:48
ordenacion shell, dejame enviartelo a tu email,,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar