function rand80() {
let result = ''+Math.floor(Math.random()*10000000000);
for (let i = 0; i < 7; i++) {
result += ('0000000000'+Math.floor(Math.random()*10000000000)).substr(-10);
}
return result;
}
console.log(rand80());
78687700753019149846288536942965286843811762227419373094448469993291737449820343
positions := array[0..max_scores] of 0
foreach of scores as score
positions[score] := 1
position := 1
for i := max_scores to 0
temp := position + positions[i]
positions[i] := position
position := temp
result := array[]
foreach of alice as score
result[] := positions[score]
n | O(n) | O(log n)
1 | 1 | 100
10 | 10 | 200
100 | 100 | 300
1000 | 1000 | 400
a×n = b×log(n)
var t = {
list: {
"action_buttons[0]": "View",
"action_buttons[1]": "Share",
"action_buttons[2]": "Download",
"columns[0]": "Date of Study",
"columns[1]": "Patient",
"columns[2]": "File name",
"columns[3]": "Reporting <br>Physician",
"columns[4]": "Institution"
}
};
var list = {};
var re = /^(.*?)\[(\d+)\]$/;
var match;
for (var prop in t.list) {
match = prop.match(re);
if (typeof list[match[1]] == "undefined") {
list[match[1]] = [];
}
list[match[1]][match[2]] = t.list[prop];
}
t.list = list;
console.log(t);
{…}
list: {…}
action_buttons: […]
0: "View"
1: "Share"
2: "Download"
columns: […]
0: "Date of Study"
1: "Patient"
2: "File name"
3: "Reporting <br>Physician"
4: "Institution"