Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- Console.WriteLine("Please enter your list seperated by commars: e.g 12,4,3,")
- Dim strInput As String
- strInput = Console.ReadLine()
- Dim listOfNumbers() As String
- listOfNumbers = Split(strInput, ",")
- Console.WriteLine("Would you to sort, search or pack the list?")
- Select Case Console.ReadLine
- Case 1
- End Select
- End Sub
- Function binarySearch(needle, haystack)
- Dim found As Boolean = False
- Dim n As Integer = haystack.getlength(0)
- Do Until found
- Loop
- End Function
- Function bubbleSort(ByVal list)
- Dim change As Boolean = True
- While change = True
- change = False
- For i As Integer = 0 To list.getlenth(0) - 2
- If (list(i) > list(i + 1)) Then
- Dim holder As Integer
- holder = list(i)
- list(i) = list(i + 1)
- list(i + 1) = holder
- change = True
- End If
- Next
- End While
- Return list
- End Function
- Function quickSort(ByVal list)
- If list.getlength(0) = 1 Then
- Return list
- Else
- Dim pivot As Integer = list(0)
- Dim lower() As Integer
- Dim higher() As Integer
- For i As Integer = 0 To list.getlength(0)
- If (list(i) > pivot) Then
- higher(higher.GetLength(0)) = list(i)
- Else
- lower(lower.GetLength(0)) = list(i)
- End If
- Next
- Return "a" 'merge lower+pivot+higher
- End If
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment