Ref: 2 step by step diagrams added.
This commit is contained in:
35
analysis/04-reverse-linked-list/diagrams/05_final_state.puml
Normal file
35
analysis/04-reverse-linked-list/diagrams/05_final_state.puml
Normal file
@@ -0,0 +1,35 @@
|
||||
@startuml
|
||||
title Step 5 — Final State
|
||||
|
||||
object "Node 1" as n1 {
|
||||
value = 1
|
||||
}
|
||||
|
||||
object "Node 2" as n2 {
|
||||
value = 2
|
||||
}
|
||||
|
||||
object "Node 3" as n3 {
|
||||
value = 3
|
||||
}
|
||||
|
||||
n3 --> n2 : next
|
||||
n2 --> n1 : next
|
||||
n1 --> "null" : next
|
||||
|
||||
object "head" as head
|
||||
object "previous" as prev
|
||||
object "current" as cur
|
||||
|
||||
head --> n3
|
||||
prev --> n3
|
||||
cur --> "null"
|
||||
|
||||
note right of head
|
||||
When current becomes null,
|
||||
previous points to the new head.
|
||||
|
||||
head = previous
|
||||
end note
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user