Results 1 to 4 of 4

Thread: Bubble Sorting Words Alphabetically

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Posts
    13

    Bubble Sorting Words Alphabetically

    Hello i have a few names in a list box (string).
    How do i use bubble sorting to sort them in alphabetical order.

    Any help is appreciated
    Thanks

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Bubble Sorting Words Alphabetically

    Code:
    Function Sort(ByVal list() as String)
        Dim temp as String
        For x = UBound(list) - 1 to 0 step - 1
            For y = 0 to x - 1
             If list(y) > list(y + 1) then
                temp = list(y) 
                list(y) = list(y + 1)
                list(y + 1) = temp
             End If
            Next
        Next 
    End Function
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Bubble Sorting Words Alphabetically

    Hi Pradeep. I have a homework assignment too but I'd rather cheat also so can you write my code for me too? Persoanlly, I think it's fine for me to get full marks even though I may have put no effort into the assignment while my classmates who have tried may not. I'm glad that you feel the same.

  4. #4
    Addicted Member
    Join Date
    Mar 2010
    Posts
    226

    Re: Bubble Sorting Words Alphabetically

    There are also special cases for uniform alphabet usages. There are lots of solutions for this case to collect inside issue based folders to obtain the paradigm.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width