From ac63329b2a3403de1c6fbc06144780e023d24287 Mon Sep 17 00:00:00 2001 From: fanpei91 Date: Mon, 5 Feb 2018 13:26:22 +0800 Subject: [PATCH] runtime error: invalid memory address or nil pointer dereference --- data-structures/binary-tree/bst.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-structures/binary-tree/bst.go b/data-structures/binary-tree/bst.go index da1aa35..b59f779 100644 --- a/data-structures/binary-tree/bst.go +++ b/data-structures/binary-tree/bst.go @@ -105,8 +105,8 @@ func (t *Tree) Delete(i int) bool { if h.Left != nil { right := h.Right h.Value = h.Left.Value + h.Right = h.Left.Right h.Left = h.Left.Left - h.Right = h.Left.Right if right != nil { subTree := &Tree{Head: h}