Welcome :Guest

Congratulations!!!

Top 5 Contributors of the Month
Jayakumar

 Home >> Forum >> VB.Net >> Post New Question Subscribe to Forum
Author: nishithraj
Posted Date: December 30, 2009     Points: 5

Hi Sushant, Your requirement is not clear in the question. Can you elaborate your requirement?

Following is the code for bubble sort in VB.NET

`For outer = n - 1 to 0 step - 1    For inner = 0 to outer - 1     If list(inner) > list(inner + 1) then        temp = list(inner)         list(inner) = list(inner + 1)        list(inner + 1) = temp     end if    NextNext For outer = n - 1 to 0 step - 1    For inner = 0 to outer - 1     If list(inner) < list(inner + 1) then        temp = list(inner)         list(inner) = list(inner + 1)        list(inner + 1) = temp     end if    NextNext `

And for the selection sort following is the code.
`    Sub SelSort(ByRef X() As Integer, ByVal start As Integer, ByVal stopp As Integer)        Dim begin As Integer = start        Dim smallsofar As Integer = begin        Dim tmp As Integer, i As Integer        If start < stopp Then            For i = begin + 1 To stopp + 1                If X(i) < X(smallsofar) Then smallsofar = i            Next i            tmp = X(begin)            X(begin) = X(smallsofar)            X(smallsofar) = tmp            SelSort(X, start + 1, stopp)        End If    End Sub    Sub Main()        Dim I As Integer        Dim x() As Integer = {5, 2, 4, 6, 1, 3}        Console.WriteLine("Unsorted Array:")        For I = 0 To x.GetUpperBound(0)            Console.Write("{0} ", x(I))        Next I        SelSort(x, 0, x.GetUpperBound(0) - 1)        Console.WriteLine("{0}SORTED ARRAY:", Chr(10))        For I = 0 To x.GetUpperBound(0)            Console.Write("{0} ", x(I))        Next I    End Sub`

Author: Sushil
Posted Date: December 31, 2009     Points: 5

Hello sir plz give me ur Email Id then I will send u my Vb Project ,can u conert it in vb.net 2008
plz help me