maraigue / ltolist Goto Github PK
View Code? Open in Web Editor NEWData structure for a linear list; O(log n) time for all of a random access, an insertion and a deletion ランダムアクセス・挿入・削除がいずれもO(log n)時間の線形リスト(一列に値を並べるリスト)
License: MIT License
Data structure for a linear list; O(log n) time for all of a random access, an insertion and a deletion ランダムアクセス・挿入・削除がいずれもO(log n)時間の線形リスト(一列に値を並べるリスト)
License: MIT License
#include "LTOList.hpp"
#include <iostream>
int main(void){
size_t n = 9;
LTOList<double> ot;
for(size_t i = 0; i < n; ++i) ot.insert(ot.end(), i);
std::cout << "-----------------------------------------------" << std::endl;
std::cout << "OrigSize=" << n << " (SizeAfterPop=" << (n-1) << ")" << std::endl;
std::cout << std::endl;
ot.base_.display_tree(std::cout); // suppose that `base_` is made `public` (originally `private`)
std::cout << std::endl;
ot.pop_front();
ot.base_.display_tree(std::cout);
std::cout << std::endl;
}
produced the following:
{LTOList Size=9 Origin=0xd13870 Root=0xd13530 Front=0xd138b0 Back=0xd13830}
<B>[0 this=0xd138b0 parent=0xd134f0 children=0,0] 0
<B>[1 this=0xd134f0 parent=0xd13530 children=1,1] 1
<B>[2 this=0xd13570 parent=0xd134f0 children=0,0] 2
<B>[3 this=0xd13530 parent=0xd13870 children=3,5] 3
<B>[4 this=0xd136f0 parent=0xd13a70 children=0,0] 4
<B>[5 this=0xd13a70 parent=0xd13530 children=1,3] 5
<B>[6 this=0xd13bf0 parent=0xd13af0 children=0,0] 6
<R>[7 this=0xd13af0 parent=0xd13a70 children=1,1] 7
<B>[8 this=0xd13830 parent=0xd13af0 children=0,0] 8
{LTOList Size=9 Origin=0xd13870 Root=0xd13a70 Front=0xd134f0 Back=0xd13830}
<B>[0 this=0xd134f0 parent=0xd13530 children=0,1] 1
<R>[1 this=0xd13570 parent=0xd134f0 children=0,0] 2
<B>[3 this=0xd13530 parent=0xd13a70 children=3,1] 3
<B>[4 this=0xd136f0 parent=0xd13530 children=0,0] 4
<B>[5 this=0xd13a70 parent=0xd13870 children=5,3] 5
<B>[6 this=0xd13bf0 parent=0xd13af0 children=0,0] 6
<B>[7 this=0xd13af0 parent=0xd13a70 children=1,1] 7
<B>[8 this=0xd13830 parent=0xd13af0 children=0,0] 8
The strange point is <B>[5 this=0xd13a70 parent=0xd13870 children=5,3] 5
in the latter tree; although number of left and right child nodes of the node are 4 and 3, respectively, it displays children=5,3
.
I examined this situation for n = 4 to 24, and found that such a behavior is produced for n = 9, 10, 19, 20, 21 and 22.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.