mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark results
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
async function findLISLength(arr) {
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm');
|
||||
const findLISLength = async (arr) => {
|
||||
const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array');
|
||||
|
||||
if (!arr?.length) return 0;
|
||||
|
||||
@@ -11,5 +11,5 @@ async function findLISLength(arr) {
|
||||
}
|
||||
|
||||
return tails.length;
|
||||
}
|
||||
};
|
||||
export default findLISLength;
|
||||
@@ -1,16 +1,16 @@
|
||||
async function findLISLength(nums) {
|
||||
const findLISLength = async (nums) => {
|
||||
if (!nums?.length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm');
|
||||
|
||||
const sub = [];
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array/+esm');
|
||||
|
||||
for (const num of nums) {
|
||||
sub[bisectLeft(sub, num)] = num;
|
||||
}
|
||||
const tails = [];
|
||||
|
||||
return sub.length;
|
||||
}
|
||||
nums.forEach((num) => {
|
||||
tails[bisectLeft(tails, num)] = num;
|
||||
});
|
||||
|
||||
return tails.length;
|
||||
};
|
||||
export default findLISLength;
|
||||
@@ -0,0 +1,9 @@
|
||||
const findLISLength = async (nums) => {
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm');
|
||||
const tails = [];
|
||||
for (const n of nums) {
|
||||
tails[bisectLeft(tails, n)] = n;
|
||||
}
|
||||
return tails.length;
|
||||
};
|
||||
export default findLISLength;
|
||||
@@ -1,7 +0,0 @@
|
||||
const findLISLength = async arr => {
|
||||
const { bisectLeft } = await import('https://esm.sh/d3-array')
|
||||
const tails = []
|
||||
for (const n of arr) tails[bisectLeft(tails, n)] = n
|
||||
return tails.length
|
||||
}
|
||||
export default findLISLength;
|
||||
@@ -1,12 +1,14 @@
|
||||
export const findLISLength = async (arr) => {
|
||||
if (!Array.isArray(arr) || !arr.length) return 0;
|
||||
try {
|
||||
const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array@3');
|
||||
const t = [];
|
||||
for (const v of arr) t[bisectLeft(t, v)] = v;
|
||||
return t.length;
|
||||
} catch {
|
||||
return 0;
|
||||
export async function findLISLength(nums) {
|
||||
if (!Array.isArray(nums) || nums.length === 0) return 0;
|
||||
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm');
|
||||
const tails = [];
|
||||
|
||||
for (const num of nums) {
|
||||
const idx = bisectLeft(tails, num);
|
||||
idx === tails.length ? tails.push(num) : tails[idx] = num;
|
||||
}
|
||||
};
|
||||
|
||||
return tails.length;
|
||||
}
|
||||
export default findLISLength;
|
||||
@@ -1,11 +1,10 @@
|
||||
const findLISLength = async nums => {
|
||||
if (!Array.isArray(nums)) throw new TypeError('Expected array')
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm')
|
||||
const tails = []
|
||||
for (const v of nums) {
|
||||
const i = bisectLeft(tails, v)
|
||||
i === tails.length ? tails.push(v) : tails[i] = v
|
||||
async function findLISLength(a) {
|
||||
const {bisectLeft} = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm')
|
||||
const t=[]
|
||||
for (const x of a||[]) {
|
||||
const i = bisectLeft(t,x)
|
||||
t[i]=x
|
||||
}
|
||||
return tails.length
|
||||
return t.length
|
||||
}
|
||||
export default findLISLength;
|
||||
@@ -1,2 +1,2 @@
|
||||
async function findLISLength(arr){const{bisectLeft}=await import('https://cdn.skypack.dev/d3-array');let tails=[];for(const num of arr){const i=bisectLeft(tails,num);i===tails.length?tails.push(num):tails[i]=num;}return tails.length;}
|
||||
async function findLISLength(a){const{bisectLeft}=await import('https://cdn.skypack.dev/d3-array');let t=[];for(let n of a){let i=bisectLeft(t,n);i===t.length?t.push(n):t[i]=n}return t.length}
|
||||
export default findLISLength;
|
||||
Reference in New Issue
Block a user