2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,4 @@
struct Node<T> {
elem: T,
next: Option<Box<Node<T>>>,
}

View file

@ -0,0 +1,16 @@
type Link<T> = Option<Box<Node<T>>>; // Type alias
pub struct List<T> { // User-facing interface for list
head: Link<T>,
}
struct Node<T> { // Private implementation of Node
elem: T,
next: Link<T>,
}
impl<T> List<T> {
#[inline]
pub fn new() -> Self { // List constructor
List { head: None }
// Add other methods here
}

View file

@ -0,0 +1,8 @@
extern crate LinkedList; // Name is arbitrary here
use LinkedList::List;
fn main() {
let list = List::new();
// Do stuff
}

View file

@ -1,4 +0,0 @@
enum SingleLinkedList<T> {
Node(T, Box<SingleLinkedList<T>>),
None
}