fixed error when the list is empty (#637)

* feat: Add Go code to binary search recursion under divide and conquer

* style: Code comment standardization

* style: modify function comment

* fix: fixed error when the list is empty

* Update print_utils.go

* Delete print_utils_test.go

---------

Co-authored-by: Yudong Jin <krahets@163.com>
pull/639/head
Hongyun Zhang 1 year ago committed by GitHub
parent da2c71d936
commit 8068c42688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,6 +19,10 @@ func PrintSlice[T any](nums []T) {
// PrintList Print a list
func PrintList(list *list.List) {
if list.Len() == 0 {
fmt.Print("[]\n")
return
}
e := list.Front()
// 强转为 string, 会影响效率
fmt.Print("[")

Loading…
Cancel
Save