Post Reply 
(12C) Bubble Sort
05-13-2018, 06:47 AM (This post was last modified: 05-13-2018 12:28 PM by Gamo.)
Post: #1
(12C) Bubble Sort
Going through old forum and saw very interesting topic about HP-12C
Hidden Indirect Register Access by the use of the CFj and RCL CFj functions to store and recall indirectly through the [n] Register.

I like to share this program and see if anyone can put this routine into other useful program or improve this sorting program.

Bubble Sort:

Procedure:
Put Data into CFj > RCL [n] > R/S
Data From largest to smallest start from Register R0 - Rx
Example if total of 10 data that will be from R0-R9 // R0 Largest R9 Smallest

f FIN > f REG // Clear Financial and Register
11 CFj
19 CFj
13 CFj
17 CFj
20 CFj

RCL [n] > 5 R/S > 0

11 19 13 17 20 (Unsort)
---------------------------
20 19 17 13 11 (Sorted)

RCL 0 > 20
RCL 1 > 19
RCL 2 > 17
RCL 3 > 13
RCL 4 > 11



Program:
Quote:STO [i]
1
STO [n]
RCL CFj
RCL CFj
X≤Y
X<>Y
CFj
RCL [i]
RCL [n]
1
+
X≤Y
GTO 03
2
-
X=0
GTO 00
GTO 01

This program is Posted by Katie on 26 Oct 2003
http://www.hpmuseum.org/cgi-sys/cgiwrap/...read=45179

Gamo
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)