# Tree & Binary Search Tree

Dev_minยท2019๋…„ 9์›” 18์ผ
0

DataStructure

๋ชฉ๋ก ๋ณด๊ธฐ
5/6

๐ŸŒดTree

Tree๋Š” ์•„๋ž˜๋ฐฉํ–ฅ์œผ๋กœ ์—ฐ๊ฒฐ๋œ ๊ณ„์ธต ๊ตฌ์กฐ

tree.PNG

Tree ๊ตฌ์กฐ ์ด๋ฏธ์ง€
< ์ด๋ฏธ์ง€ ์ฐธ์กฐ : https://gmlwjd9405.github.io/2018/08/12/data-structure-tree.html >

Tree ํŠน์ง•

Tree๊ตฌ์กฐ๋Š” ๋ฃจํŠธ ๋…ธ๋“œ์—์„œ ์–ด๋Š ์ž์‹ ๋…ธ๋“œ๋กœ ์—ฐ๊ฒฐ์ด ๊ฐ€๋Šฅํ•˜๊ณ ,

๊ฐ ์ž์‹ ๋…ธ๋“œ์˜ ๋ถ€๋ชจ๋Š” ์œ ์ผํ•˜๋‹ค. Leaf Node๋Š” ์ž์‹์ด ์—†๋Š” ๋…ธ๋“œ

Tree Method

insert, get, add, remove

Tree ์‚ฌ์šฉ

BST(์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜), ๊ณ„์ธต๊ตฌ์กฐ ๋“ฑ

Tree Pseudo Code

// ์˜ˆ์‹œ

๐ŸŒฒBinary Search Tree

์ด์ง„ํŠธ๋ฆฌ๋Š” ๊ฐ ๋…ธ๋“œ๊ฐ€ ์ตœ๋Œ€ ๋‘ ๊ฐœ์˜ ์ž์‹์„ ๊ฐ–๋Š” ํŠธ๋ฆฌ

์ด์ง„ํƒ์ƒ‰๊ณผ ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ฒฐํ•ฉํ•œ ์ž๋ฃŒ๊ตฌ์กฐ์˜ ์ผ์ข…

์ด์ง„ํƒ์ƒ‰ํŠธ๋ฆฌ๋Š” ๋ฌด์กฐ๊ฑด ์™ผ์ชฝ ์„œ๋ธŒ ๋…ธ๋“œ์—์„œ๋ถ€ํ„ฐ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ํƒ์ƒ‰์„ ์ง„ํ–‰ํ•œ๋‹ค.(์ค‘์œ„์ˆœํšŒ ๋ฐฉ์‹)

tree2.PNG

ํ•ต์‹ฌ ์—ฐ์‚ฐ์€ ๊ฒ€์ƒ‰(retreive), ์‚ฝ์ž…(insert), ์‚ญ์ œ(delete)

Binary Search Tree ์‚ฌ์šฉ

์ •๋ ฌ/๊ฒ€์ƒ‰ ์•Œ๊ณ ๋ฆฌ์ฆ˜, JPEG์ธ์ฝ”๋” ๋“ฑ

Graph์˜ Pseudo Code

// ์˜ˆ์‹œ
profile
TIL record

0๊ฐœ์˜ ๋Œ“๊ธ€