!!?How to sort registers Did you play a game called HULK. I played that game when I was young – I am still young. Well, if you play this game you have to pass some stages. One of these stages is to sort some numbers. I wasn't able to sort them using the method of looking for the lowest number and click on it to bring it to the first position then I look for the next number and so on. I was .slow I had to think about a method of sorting the numbers automatically by just clicking on it somehow. Lets try to do this Look at these numbers 3 1 4 5 2 If you want to sort it you will look for the number 1 and bring it to the first place. Then you will look for the next number and bring it to the next place and so on. This will take the time of .searching for the number and the replacement Let's try the other method. I wanted an automatic method for it. .So I did this I looked at the first two places (registers) and sort them. Then I sort the next two places and so on. If you do this many times (repeat it) you will get them sorted. Like this 25413 25431 25431 52431 52431 52431 54231 54231 54231 54321
You just have to make a look that sort the registers like this and repeat the loop again equal to number of registers. I mean two .loops inside each other You can develop this method as you can to make the time taken less. You don't have to sort the sorted registers again at the end of the array because every loop you have already sorted a .register