in Search
     
Latest post 10-17-2007 10:43 PM by lamia. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-17-2007 7:30 PM

    • cyrose30
    • Top 200 Contributor
    • Joined on 10-17-2007
    • Posts 4
    • Points 95

    function swap (x, y)

    how can i put the lowest number in left side one by one?

    example.. i'll put the 5 numbers in input box..

    5 23 4 6 8

    number 4 is lower than 23 so it will move at left sides of number 23 and number 5.. it will be come..

    4 5 23 6 8

    then the next is 5.. the question will ask.. 5 is higher than 4 and lower than 23..

    then the next is 6.. 6 is lower than 23 so it will move at 23's left's side..

    4 5 6 23 8

    then the next is 8.. 8 is lower than 23, so it will move at left side..

    4 5 6 8 23..

    then it says.. 4 is lowest number and 23 is the highest number..

    plz help me.. this is my first time to used php that's why i'm 0 knowledge bout this..

    thankx!!!!c",

    • Post Points: 50
  • 10-17-2007 10:43 PM In reply to

    • lamia
    • Top 10 Contributor
    • Joined on 06-19-2006
    • Sampaloc, Manila
    • Posts 752
    • Points 13,185

    Re: function swap (x, y)

     

    Convert limitations to great expectations... You are the creative force of your life...

    • Post Points: 5
  • 10-18-2007 3:10 AM In reply to

    • cruizer
    • Top 10 Contributor
    • Joined on 12-13-2005
    • Singapore
    • Posts 944
    • Points 22,590

    Re: function swap (x, y)

    put all those numbers in an array. you can use the explode() function for that, reference here: http://us.php.net/manual/en/function.explode.php

    use the sort() function to sort an array, reference here: http://us.php.net/manual/en/function.sort.php

    http://devpinoy.org/blogs/cruizer
    Naglalayong buksan at palayain ang kamalayan ng Pinoy .NET developer
    • Post Points: 5
  • 10-24-2007 8:34 PM In reply to

    • DOBius
    • Top 500 Contributor
    • Joined on 10-25-2007
    • Roxas City, Philippines
    • Posts 3
    • Points 60

    Re: function swap (x, y)

    try this sorting algorithm

    <a href="http://www.concentric.net/~Ttwang/sort/sort.htm">http://www.concentric.net/~Ttwang/sort/sort.htm</a> 

    Did you remember the day you remembered yourself?
    • Post Points: 5
Page 1 of 1 (4 items)