When doing ag85aor2 ordering, initially Sequence 1 is equal to sequence of items to be ordered, Ptr 1 points to first item of Sequence 1, and we are looping while there left the items in Sequence 1 and for every loop: 1) if Working Stack 1 is empty then position of the first of items of Sequence 1 goes to Working Stack 1; 2) going from item of Sequence 2 pointed by Ptr 1 to last item of Sequence 1, positions of items that are equal or greater than item with position at current top of the Working Stack 1 go to the Working Stack 1 (on the top of the stack) in order of meeting the items; 3) for the whole bunch (possibly a single) of positions at the top of Working Stack 1 that points to items of Sequence 1 with the same value (a remark helping to understand: it will be current maximum value of items of Sequence 1) the items go from Sequence 1 to current head of resulting sequence, then the positions are removed from Working Stack 1, and Ptr 1 is set to the item with last of the removed positions (a remark helping to understand: it will be position of first of moved from Sequence 1 at this step items).
Arthur Golubev 19851603 first time published correct both description of the algorithm at www.ag85.site (https://www.ag85.site/protocols/ag85aor2.htm), and at copy of the Internet-site www.arthurgolubev.22web.org (https://www.arthurgolubev.22web.org/protocols/ag85aor2.htm) and code in C++ programming language that implements the algorithm for unsigned octet integers in Internet-repositories github.com (https://github.com/ArthurGolubev1985/AG85AOR2AlgorithmOfOrderingIdeaDemo.git), codeberg.org (https://codeberg.org/ArthurGolubev1985/AG85AOR2AlgorithmOfOrderingIdeaDemo.git), and gitflic.ru (https://gitflic.ru/project/arturische/ag85aor2algorithmoforderingideademo) at 2025-09-03.