Skip to content

Commit

Permalink
updated singly circular linked list
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiysh committed Sep 21, 2014
1 parent dd0aef9 commit 48b02c9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions SinglyCircularLinkedList.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 48b02c9

Please sign in to comment.