diff --git a/SinglyCircularLinkedList.go b/SinglyCircularLinkedList.go index da3e8cb..1364078 100644 --- a/SinglyCircularLinkedList.go +++ b/SinglyCircularLinkedList.go @@ -175,6 +175,25 @@ func main() { fmt.Println("Initial condition:") s.PrintToRight() + fmt.Printf("\nInsert \"hello\" as head and set old head as head's prev\n") + s.InsertPrev(&Node{"hello", nil}) + s.PrintToRight() + fmt.Printf("\nInsert \"world\" as head and set old head as head's prev\n") + s.InsertPrev(&Node{"world", nil}) + s.PrintToRight() + fmt.Printf("\nInsert 3.14 as head and set old head as head's next\n") + s.InsertNext(&Node{3.14, nil}) + s.PrintToRight() + fmt.Printf("\nDelete head and set head's prev as new head\n") + s.DeletePrev() + s.PrintToRight() + fmt.Printf("\nDelete head and set head's next as new head\n") + s.DeleteNext() + s.PrintToRight() + fmt.Printf("\nDelete head and set head's next as new head\n") + s.DeleteNext() + s.PrintToRight() + for i := 1; i <= 3; i++ { fmt.Printf("\nInsert %d as head and set old head as head's next\n",i) s.InsertNext(&Node{i, nil})