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

Re-considering data structures #16

Open
ahmedh409 opened this issue Mar 1, 2022 · 0 comments
Open

Re-considering data structures #16

ahmedh409 opened this issue Mar 1, 2022 · 0 comments
Labels

Comments

@ahmedh409
Copy link
Owner

The current blockchain uses a singly-linked list, meaning each node only points to the next. The next natural step from a singly-linked list is a doubly-linked list, which would allow traversal in both directions, but both still bottleneck with a query complexity of O(n).
We should consider new data structures for the blockchain as part of a "hardcore refactoring" for the codebase. I had an idea to implement the chain using skip lists which are commonly used in distributed systems and large-scale structures; these have a query complexity of O(log n) instead of linear since they have double links as well as "skip links" which can skip multiple nodes in order to efficiently traverse a list. Here's a paper to introduce the idea.
Another idea is implementing trees (Red-Black?) which tend to have a logarithmic query time, as well. Each "block" could be replaced by a tree which contains media with similar perceptual hashes; in this case, the user would traverse until a "similar" video is found, then it would run down the tree and find the specific video. This seems a little less elegant than skip lists, but could be really interesting - got the idea from the Linux CFS.

@ahmedh409 ahmedh409 added the v0.5 label Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant