1 | static double percentageSorted(L l) { |
2 | if (l(l) < 2) ret 100; |
3 | int sorted = 0; |
4 | for (int i = 0; i < l(l)-1; i++) |
5 | if (cmp(l.get(i), l.get(i+1)) <= 0) |
6 | ++sorted; |
7 | ret sorted*100.0/(l(l)-1); |
8 | } |
Began life as a copy of #1005380
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005381 |
Snippet name: | percentageSorted |
Eternal ID of this version: | #1005381/1 |
Text MD5: | a4b7bc133019012cf5a7a626a015323a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-10 17:32:27 |
Source code size: | 209 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 526 / 509 |
Referenced in: | [show references] |