用于实现列表和双端队列的创新数据结构 ShiftToMiddleArray
https://github.com/attilatorda/Shift-To-Middle_Array
看到一个新的数据结构,双端队列,头插 尾插
初始 head 指针放在中间, 尾插就右移,头插就左移动。
但是我本地 macos 测试几次ArrayList 反而更好....
ShiftToMiddleArrayBenchmark
Test size: 0
Benchmarking ArrayList...
ArrayList: 4.417 ms
Benchmarking LinkedList...
LinkedList: 6.750083 ms
Benchmarking ShiftToMiddleArray...
ShiftToMiddleArray: 4.124417 ms
Test size: 10
Benchmarking ArrayList...
ArrayList: 8.334208 ms
Benchmarking LinkedList...
LinkedList: 3.34575 ms
Benchmarking ShiftToMiddleArray...
ShiftToMiddleArray: 3.215917 ms
Test size: 100
Benchmarking ArrayList...
ArrayList: 8.216417 ms
Benchmarking LinkedList...
LinkedList: 15.599375 ms
Benchmarking ShiftToMiddleArray...
ShiftToMiddleArray: 6.901959 ms
Test size: 1000
Benchmarking ArrayList...
ArrayList: 7.886875 ms
Benchmarking LinkedList...
LinkedList: 39.867833 ms
Benchmarking ShiftToMiddleArray...
ShiftToMiddleArray: 31.238458 ms
Test size: 5000
Benchmarking ArrayList...
ArrayList: 125.966417 ms
Benchmarking LinkedList...
LinkedList: 1241.859416 ms
Benchmarking ShiftToMiddleArray...
ShiftToMiddleArray: 295.465666 ms
Test size: 10000
Benchmarking ArrayList...
ArrayList: 446.160792 ms
Benchmarking LinkedList...
LinkedList: 8687.311666 ms
Benchmarking ShiftToMiddleArray...
ShiftToMiddleArray: 1325.725834 ms
Process finished with exit code 0