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

24
LINES

< > BotCompany Repo | #1003142 // Bubblesort Concept

Document

// Where we want to go

for i=0 to 9
  for j=i to 9
    if get(j) < get(i) then swap(i, j) end
  end
end


// The program!

0 10 i j for for ifless swap

// numbers can be used multiple times,
// the other items are to be used exactly once each

for(variable, exp, exp, code) -> code
ifless(exp, exp, code) -> code
swap(exp, exp) -> code
variable -> exp
number -> exp
get(exp) -> exp  // << always available, at least one level deep

[+ 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: 601 / 125
Referenced in: [show references]