package main

import (
	"bufio"
	"fmt"
	"os"
	ds "source/pkg/data_struct"
	bst "source/pkg/structures/bin_search_tree"
)

const (
	countNumbers = 64
)

func pressEnterToContinue() {
	fmt.Print("Нажмите Enter для продолжения...")
	bufio.NewReader(os.Stdin).ReadBytes('\n')
}

// isInArr проверяет, содержится ли target в срезе arr[:len]
func isInArr(arr []int, length int, target int) bool {
	for i := 0; i < length; i++ {
		if arr[i] == target {
			return true
		}
	}
	return false
}

func main() {
	fmt.Println("hello world!")

	head := bst.NewBinSearchTree()

	for i := 1; i <= 20; i++ {
		name := fmt.Sprintf("User_%02d", i)
		phone := fmt.Sprintf("Phone_%02d", i)
		head.Insert(*ds.NewData(name, phone))
	}

	head.BstInorderTraversal()

	head.Delete("User_05")
	fmt.Println("Удаляем User_05")

	head.BstInorderTraversal()

	fmt.Println(head.Search("User_07"))

}
