https://github.com/0xKarl98/Lib_LinkList
A library of linked list written in Noir
https://github.com/0xKarl98/Lib_LinkList
Last synced: 19 days ago
JSON representation
A library of linked list written in Noir
- Host: GitHub
- URL: https://github.com/0xKarl98/Lib_LinkList
- Owner: 0xKarl98
- Created: 2025-03-16T15:56:16.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-03-24T10:02:28.000Z (about 1 month ago)
- Last Synced: 2025-03-24T11:23:13.871Z (about 1 month ago)
- Language: Noir
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-noir - Lib_LinkList - A memory-efficient doubly-linked list implementation for Noir that supports constant-time operations at both ends (Libraries / Data Type Manipulation)
README
# Lib_LinkList
A memory-efficient doubly-linked list implementation in Noir, using a HashMap for node storage. This implementation supports constant-time operations at both ends of the list, making it suitable for queue, stack, and deque use cases in Noir applications.
## Features
- **Constant-time operations**: `push_front`, `push_back`, `pop_front`, and `pop_back` all operate in O(1) time
- **Memory efficiency**: Uses HashMap for node storage with key recycling
- **Type flexibility**: Supports generic types through Noir's type system
- **Configurable capacity**: Maximum size can be specified at compile time## Installation
Add the library to your Noir project by specifying it as a dependency in your `Nargo.toml` file:
```toml
[dependencies]
libLinkedList = { git = "https://github.com/0xKarl98/Lib_LinkList" }
```## Usage
Here's a basic example of how to use the LinkedList:
use libLinkedList::linked_list::{LinkedList, Node};
```
fn main() {
// Create a new LinkedList with a maximum capacity of 10 elements
let mut list = LinkedList::::new();
// Add elements to the list
list.push_back(1);
list.push_back(2);
list.push_front(0);
// Remove elements from the list
let first = list.pop_front(); // returns Option::some(0)
let last = list.pop_back(); // returns Option::some(2)
// Clear the list
list.clear();
}
```## Limitations
- The maximum size of the list must be specified at compile time
- Currently does not support iteration over elements## Future Enhancements
- [ ] Implement node splice, detach, and split operations
- [ ] Add iterator and cursor functionality if needed