Home Page Services Solutions Articles History Contacts Links Versione Italiana
Software
2D Creations
3D Creations
Images
Open Source
Projects
Web Utilities
Graphic Tools
Downloads
Documents

Implementazione QuickSort Ricorsivo in VbScript per ASP 3.0


Ecco a voi l'implementazione di uno dei pił veloci algoritmi di ordinamento, sapendo di fare sicuramente cosa gradita, sotto potete prelevare questa traduzione dell'Algoritmo di Ordinamento conosciuto come QuickSort in ASP/VbScript.

Sub SwapValue(ByRef ValueA, ByRef ValueB)
  Dim Tmp
  Tmp = ValueA
  ValueA = ValueB
  ValueB = Tmp
End Sub

Sub SeparaLista(ByRef MyArray(), ByVal Low, ByVal High, ByRef Pivot)
  Pivot=Low
  Low=Low+1
  Do While (High-Low>1)
    If (MyArray(Low)<=MyArray(Pivot)) And (Low<High) Then Low=Low+1
    If (MyArray(High)>=MyArray(Pivot)) And (Low<High) Then High=High-1
    If (MyArray(Low)>MyArray(High)) Then SwapValue MyArray(Low), MyArray(High)
  Loop
 If (MyArray(Pivot)>MyArray(Low)) Then
    SwapValue MyArray(Pivot), MyArray(Low)
    SwapValue Pivot, Low
 Else
    SwapValue MyArray(Pivot), MyArray(Low-1)
    Low=Low-1
    SwapValue Pivot, Low
 End If  
End Sub

Sub TreeSort(ByRef A, ByRef B, ByRef C)
  If ((A>B) And (A>C)) Then
      SwapValue A,C
   ElseIf ((B>A) And (B>C)) Then
       SwapValue B,C
    End If
  If (A>B) Then SwapValue A,B
End Sub  

Sub QuickSort(ByRef MyArray(), Low, High)
  Dim Pivot
  If (High-Low<=1) Then
    If (MyArray(Low)>MyArray(High)) Then SwapValue MyArray(Low),MyArray(High)
  ElseIf (High-Low=2) Then
    TreeSort MyArray(Low),MyArray(Low+1),MyArray(High)
  ElseIf (High-Low>2) Then
    SeparaLista MyArray, Low, High, Pivot
    QuickSort MyArray,Low,Pivot-1
    QuickSort MyArray,Pivot+1,High
  End If
End Sub






Home Page Services Solutions Articles History Contacts Links Italian Version

Personal sites and projects: E-Mercanti Services, Programmers Community, E-Merchants Community, Game Developing Community, Programming & Videogames, Programming Portal, Graphic Portal, Services for people looking for a job, Search Engine for Accommodations, Hosting Services, Internet Services for Identity Verification, Cheap Hosting Services and Domain Registration, Hardware and Software E-Shop, The Whole Giovanni Ceglia's Network. Real Estate Listings in English, Real Estate Listings in Italian, Real Estate Listings in German, Malmignatta Search Engine, Malmignatta Search Engine in English.


All material on this site is © CopyRight Giovanni Ceglia since 2003, all the right are reserved, the copy and redistribution of the material on this site is forbidden without permission. If there are words about trade marks they are of respective owners. Giovanni Ceglia - Computer Science Services & Programmer, Internet and Hosting Services, Business Number(Italian IVA) N. 03972320653, Based in Via Trento N.74 84016, Pagani (Salerno) Italy, E-Mail: giovanniceglia@xungame.com, Mobile Photne for contacts: 339-4403189.