Thread: Sorting integers in Array

  1. #1
    Registered User
    Join Date
    Nov 2019
    Posts
    50

    Sorting integers in Array

    Hi guys ;
    how could I sort an array of integers with fixed size in a random way? I mean by random way, is sorting the array randomly, choosing every time new element in the array to check .. how could I implement that? to be assure it's not homework or assignment question, it's just a question that I want to understand and to have a clue of sorting an array randomly ..


    thanks alot

  2. #2
    Registered User
    Join Date
    Feb 2019
    Posts
    720
    To understand your question: You want to pick an item randomly and place it before the greater value from the beginning of the array? That's it?
    Or... Do you want to sort the entire array? In that case, qsort() is better.

    []s
    Fred

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,169
    Sure, if you want.
    Bogosort - Wikipedia

    Throw a pack of cards into the air.
    Pick them up.
    See if they're sorted.
    Rinse and repeat.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-18-2013, 02:21 PM
  2. Replies: 3
    Last Post: 03-26-2012, 10:50 AM
  3. Replies: 9
    Last Post: 04-07-2010, 10:03 PM
  4. Sorting an array of integers
    By supermeew in forum C Programming
    Replies: 4
    Last Post: 05-02-2006, 04:58 AM
  5. Sorting Integers
    By Beginnerinc in forum C Programming
    Replies: 7
    Last Post: 02-05-2003, 04:28 PM

Tags for this Thread