Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort performance test with animation chart #2

Open
xgqfrms opened this issue Jun 10, 2020 · 2 comments
Open

sort performance test with animation chart #2

xgqfrms opened this issue Jun 10, 2020 · 2 comments

Comments

@xgqfrms
Copy link
Owner

xgqfrms commented Jun 10, 2020

sort performance test with animation chart

  1. 随机数组生成器,shuffle 洗牌
// typed array

const randomArrayGenerator = (len = 1) => {
  let result = [];
  const temp = new Uint8Array(len).map((item, i) => (item = i + 1));
  // shuffle 洗牌
  return result;
}

new Uint8Array(10).map((item, i) => (item = i + 1));
Uint8Array(10) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  1. react re-render chart with animation
@xgqfrms
Copy link
Owner Author

xgqfrms commented Jun 10, 2020

shuffle 洗牌

算法

  1. binary 分组,交叉交换,指定次数
arr = [1, 2, 3, 4];

// ES6 解构交换 swap
[c, d, a, b] = [a, b, c, d];


left = [1, 2];
right = [3, 4];

@xgqfrms
Copy link
Owner Author

xgqfrms commented Jun 10, 2020

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant