user-img
ํˆฌ ํฌ์ธํ„ฐ ๊ฐœ๋… ์„ค๋ช… 1
thumbnail
ํˆฌ ํฌ์ธํ„ฐ ๊ฐœ๋… ๊ทธ๋ฆผ์œผ๋กœ ์‰ฝ๊ฒŒ ์„ค๋ช…^^
0. ๊ธ€์ด ํ˜๋Ÿฌ๊ฐ€๋Š” ๋ฐฉํ–ฅ๋จผ์ € ๊ฐœ๋… ์„ค๋ช…์„ ํ•˜๊ณ , ํˆฌ ํฌ์ธํ„ฐ๋ฅผ ํ™œ์šฉํ•˜๋Š” ๋Œ€ํ‘œ์ ์ธ ๋ฌธ์ œ 2๊ฐœ๋ฅผ ์ง์ ‘ ํ’€์–ด๋ณด๋ฉฐ, ๊ฐœ๋…์— ๋Œ€ํ•œ ๋ณด์ถฉ์„ ํ•˜๊ฒ ๋‹ค.1. ๊ฐœ๋…1์ฐจ์› ๋ฐฐ์—ด์— ๋‘ ๊ฐœ์˜ ํฌ์ธํ„ฐ๋ฅผ ๋‘๊ณ , ๋‘ ํฌ์ธํ„ฐ์— ์˜๋ฏธ๋ฅผ ๋ถ€์—ฌํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ‘ธ๋Š” ๊ธฐ์ˆ ๋ฐฐ์—ด ์•ˆ์—์„œ ํŠน์ • ์กฐ๊ฑด์˜ ๊ฐ’์„ ๊ตฌํ•˜๋Š” ๋ฌธ์ œ์—์„œ, ์ผ๋ฐ˜์ ์œผ๋กœ ์‹œ๊ฐ„ ๋ณต์žก๋„๊ฐ€ O((N^{2}))๊ฐ€ ๋“ ๋‹ค๋ฉด, ํˆฌ ํฌ์ธํ„ฐ ๊ธฐ๋ฒ•์„ ํ™œ์šฉํ•˜๋ฉด ์‹œ๊ฐ„ ๋ณต์žก๋„๋ฅผ O(N)์œผ๋กœ ์ค„์ผ ์ˆ˜ ์žˆ๋‹ค. (์ด์œ ๋Š” ํ™œ์šฉ์„ ์‚ดํŽด๋ณด๋ฉฐ ์„ค๋ช…ํ•˜๊ฒ ๋‹ค.)(1) ์œ ํ˜•ํˆฌ ํฌ์ธํ„ฐ๋ฅผ ์šด์šฉํ•˜๋Š” ์œ ํ˜•์—๋Š” ํฌ๊ฒŒ 2๊ฐ€์ง€๊ฐ€ ์žˆ๋‹ค.a.๋‹จ๋ฐฉํ–ฅ ์šด์šฉL ํฌ์ธํ„ฐ์™€ R ํฌ์ธํ„ฐ๊ฐ€ ํ•œ์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ๋งŒ ์›€์ง์ด๋Š” ๊ฒƒ์ด๋‹ค. ์Šฌ๋ผ์ด๋”ฉ ์œˆ๋„์šฐ์˜ ์–‘๋์„ ์˜๋ฏธํ•œ๋‹ค๊ณ  ๋ณด๋ฉด ๋œ๋‹ค. ์Šฌ๋ผ์ด๋”ฉ ์œˆ๋„์šฐ์™€ ๋‹ค๋ฅธ ์ ์€ ํฌ์ธํ„ฐ์— ๋”ฐ๋ผ ๊ตฌ๊ฐ„์˜ ๊ธธ์ด๊ฐ€ ๊ฐ€๋ณ€์ ์ด๋ผ๋Š” ๊ฒƒ์ด๋‹ค.b. ์–‘๋ฐฉํ–ฅ ์šด..
2024.12.23
์•Œ๊ณ ๋ฆฌ์ฆ˜/์•Œ๊ณ ๋ฆฌ์ฆ˜-์ด๋ก