...

/

Solution Review: Insertion at Tail

Solution Review: Insertion at Tail

This review provides a way to solve the "Insertion at Tail" challenge.

Solution #

Press + to interact
main.rs
linked_list.rs
mod linked_list;
use linked_list::*;
impl LinkedList{
pub fn insert_at_tail(&mut self, num: i32){
let mut temp = self.head.as_mut().unwrap();
while temp.next.is_some(){
temp = temp.next.as_mut().unwrap();
}
let new_node = Node::new(num);
temp.next = Some(Box::new(new_node));
}
}

If you grasped the logic behind insertion at the head of a ...

Access this course and 1400+ top-rated courses and projects.