Results 1 to 14 of 14

Thread: help me with code

  1. #1

    Thread Starter
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    help me with code

    Help with algorithm please guys?
    Last edited by Toph; Feb 6th, 2015 at 06:56 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,454

    Re: Sorting an array of structure

    Where's your code? If you are having troubles then that would imply that you've actually done something? What have you done? Have you stepped through your code line by line? If so, exactly where does what you actually see differ from what you expect to see?

  3. #3
    New Member
    Join Date
    Nov 2013
    Posts
    3

    Re: Sorting an array of structure


  4. #4

    Thread Starter
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: Sorting an array of structure

    I'm stuck there. Dunno what to do from here.
    And to that person that posted the link. I don't speak Spanish, and I can't get it to convert it to English.
    Last edited by Toph; Feb 14th, 2015 at 04:50 PM.

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,400

    Re: Sorting an array of structure

    Most people here would be happy to help if you post the code here in the forum.
    Most people here would not be so happy to help if you just post a pastebin link

  6. #6

    Thread Starter
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: Sorting an array of structure

    I don't see why posting it on pastebin makes a difference. Pastebin is well known. Anyway here
    Last edited by Toph; Feb 6th, 2015 at 06:47 PM.

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,400

    Re: Sorting an array of structure


  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,400

    Re: Sorting an array of structure

    to download the archive choose Save As and save it as a zip file

  9. #9

    Thread Starter
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: Sorting an array of structure

    Thanks a lot Paul. I will take my time in learning the quick sort algorithm. Practice it by hand till I'm solid. Then referring back to your code to understand what you did. Thanks it worked though.

  10. #10
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    35,242

    Re: Sorting an array of structure

    Why can't you use array.sort? If you use a custom comparator, you will get the qsort algorithm doing the sorting with your comparator, so is this an exercise in learning the qsort algorithm itself (in which case there is a video about it, which probably won't help at all, but which is entertaining)?

    https://www.youtube.com/watch?v=ywWBy6J5gz8
    My usual boring signature: Nothing

  11. #11
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,400

    Re: Sorting an array of structure

    you can fasttrack your quicksort education, by putting some Debug.Print statements in my example to view the array elements at every stage of the sorting, which will help you to understand how quicksort works

  12. #12
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    35,242

    Re: Sorting an array of structure

    My link is pretty good for visualizing how quick sort works.
    My usual boring signature: Nothing

  13. #13

    Thread Starter
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: Sorting an array of structure

    Quote Originally Posted by Shaggy Hiker View Post
    Why can't you use array.sort? If you use a custom comparator, you will get the qsort algorithm doing the sorting with your comparator, so is this an exercise in learning the qsort algorithm itself (in which case there is a video about it, which probably won't help at all, but which is entertaining)?

    https://www.youtube.com/watch?v=ywWBy6J5gz8
    haha that video is classic. Thanks, I already understand quicksort but i just forgot. aint done it in a while.

    Quote Originally Posted by Shaggy Hiker View Post
    My link is pretty good for visualizing how quick sort works.
    Quote Originally Posted by .paul. View Post
    you can fasttrack your quicksort education, by putting some Debug.Print statements in my example to view the array elements at every stage of the sorting, which will help you to understand how quicksort works
    Will do that. Thanks again you're of great help.
    Last edited by Toph; Feb 6th, 2015 at 06:42 PM.

  14. #14
    New Member
    Join Date
    Nov 2013
    Posts
    3

    Re: Sorting an array of structure

    Hello.
    First of all it is Italian and not Spanish!
    Google can translate it in your language,
    msdn exists in many languages, just search,
    the code example helps solve the problem and grasp the concept.
    I always try before asking for help in the help of Visual Studio which in the fundamental aspects is quite explanatory.
    Look at Quicksort Array of Structure.zip modified with the use of Array.Sort
    This is partially translated by Google.
    Merry Christmas
    Attached Files Attached Files

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