Ahn210
Technical User
- Jun 18, 2013
- 11
Hello,
Thanks for answering my prev. question on simple sorting of 2 column data which were:
ID nums
12 0.111
58 1.52
. .
. .
. .
101 0.5
10 2.89
I declared 2 single array ID) and nums)
DO J = 1, 9
DO K = J+1, 10
IF(nums(J) > nums(K)) THEN
temp = nums(K)
temp2 = id(k)
nums(K) = nums(J)
id(k)=id(j)
nums(J) = temp
id(j)=temp2
END IF
END DO
END DO
I know this is very simple method that works with a few rows so I wish to learn Quick sort.
I've tried to understand the quick sort code out there but it is quite hard to comprehend.
Could someone apply quick sort or any other efficient code into my example and highlight the key component?
I really appreciate your help.
Thanks for answering my prev. question on simple sorting of 2 column data which were:
ID nums
12 0.111
58 1.52
. .
. .
. .
101 0.5
10 2.89
I declared 2 single array ID) and nums)
DO J = 1, 9
DO K = J+1, 10
IF(nums(J) > nums(K)) THEN
temp = nums(K)
temp2 = id(k)
nums(K) = nums(J)
id(k)=id(j)
nums(J) = temp
id(j)=temp2
END IF
END DO
END DO
I know this is very simple method that works with a few rows so I wish to learn Quick sort.
I've tried to understand the quick sort code out there but it is quite hard to comprehend.
Could someone apply quick sort or any other efficient code into my example and highlight the key component?
I really appreciate your help.