Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/03/2010, 13:43
Ka0stj
 
Fecha de Ingreso: febrero-2010
Ubicación: México
Mensajes: 738
Antigüedad: 14 años, 2 meses
Puntos: 37
Respuesta: Ayuda con algoritmo

Prueba con esto

Código vb:
Ver original
  1. Dim array() As Integer = {0, 15, 15, 13, 8, 9, 6, 4, 2, 1, 8, 8, 4, 5, 7}
  2.        
  3.         System.Array.Sort(array)
  4.  
  5.         Dim Arreglo_Auxiliar(array.Length - 1) As Integer
  6.         Dim n As Integer = array.Length - 1
  7.         Dim dimension As Integer = (array.Length - 1) Mod 2
  8.         Dim Lista As New List(Of Integer)
  9.  
  10.         For i As Integer = 0 To array.Length - 2
  11.  
  12.             If array(i) <> array(i + 1) Then
  13.                 Lista.Add(array(i))
  14.             End If
  15.  
  16.         Next i
  17.         'Agrego el último elemento
  18.        Lista.Add(array(n))
  19.  
  20.         'Erase array
  21.        Dim NewArray(Lista.Count - 1) As Integer
  22.  
  23.         For j As Integer = 0 To Lista.Count - 1
  24.             NewArray(j) = Lista(j)
  25.  
  26.         Next
  27.  
  28.         For x As Integer = 0 To NewArray.Length - 1
  29.             MsgBox(NewArray(x).ToString)
  30.         Next