Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1003142 // Bubblesort Concept

Document

1  
// Where we want to go
2  
3  
for i=0 to 9
4  
  for j=i to 9
5  
    if get(j) < get(i) then swap(i, j) end
6  
  end
7  
end
8  
9  
10  
// The program!
11  
12  
0 10 i j for for ifless swap
13  
14  
// numbers can be used multiple times,
15  
// the other items are to be used exactly once each
16  
17  
for(variable, exp, exp, code) -> code
18  
ifless(exp, exp, code) -> code
19  
swap(exp, exp) -> code
20  
variable -> exp
21  
number -> exp
22  
get(exp) -> exp  // << always available, at least one level deep
23  
24  
[+ maybe make +1 and -1 available for off-by-one-stuff]

download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003142
Snippet name: Bubblesort Concept
Eternal ID of this version: #1003142/1
Text MD5: df4b86d14861a6f306de826a35f36553
Author: stefan
Category: javax
Type: Document
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-05-14 02:09:16
Source code size: 512 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 546 / 111
Referenced in: [show references]