<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>데이터 Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<atom:link href="https://lycos7560.com/tag/%EB%8D%B0%EC%9D%B4%ED%84%B0/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Wed, 13 Aug 2025 11:50:18 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://lycos7560.com/wp-content/uploads/2022/11/cropped-cropped-cropped-log-1-150x150-1-80x80.png</url>
	<title>데이터 Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>MySQL 서비스 관리 명령어 (Ubuntu)</title>
		<link>https://lycos7560.com/ubuntu/mysql-%ec%84%9c%eb%b9%84%ec%8a%a4-%ea%b4%80%eb%a6%ac-%eb%aa%85%eb%a0%b9%ec%96%b4-ubuntu/40254/</link>
					<comments>https://lycos7560.com/ubuntu/mysql-%ec%84%9c%eb%b9%84%ec%8a%a4-%ea%b4%80%eb%a6%ac-%eb%aa%85%eb%a0%b9%ec%96%b4-ubuntu/40254/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Wed, 13 Aug 2025 11:50:10 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[기타]]></category>
		<category><![CDATA[3306]]></category>
		<category><![CDATA[ALTER USER]]></category>
		<category><![CDATA[ALTERUSER]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[configuration file]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Data Backup]]></category>
		<category><![CDATA[data migration]]></category>
		<category><![CDATA[Data Recovery]]></category>
		<category><![CDATA[data security]]></category>
		<category><![CDATA[DataBase]]></category>
		<category><![CDATA[database administrator]]></category>
		<category><![CDATA[database list]]></category>
		<category><![CDATA[database management]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[Development Environment]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Disk]]></category>
		<category><![CDATA[error resolution]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[information]]></category>
		<category><![CDATA[iptables.]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[listening]]></category>
		<category><![CDATA[local access]]></category>
		<category><![CDATA[Manual]]></category>
		<category><![CDATA[Memory]]></category>
		<category><![CDATA[Migration]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQL account]]></category>
		<category><![CDATA[MySQL backup]]></category>
		<category><![CDATA[MySQL client]]></category>
		<category><![CDATA[MySQL configuration]]></category>
		<category><![CDATA[MySQL installation]]></category>
		<category><![CDATA[MySQL monitoring]]></category>
		<category><![CDATA[MySQL recovery]]></category>
		<category><![CDATA[MySQL setup]]></category>
		<category><![CDATA[MySQL status]]></category>
		<category><![CDATA[MySQL tips]]></category>
		<category><![CDATA[MySQL tutorial]]></category>
		<category><![CDATA[MySQL version]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[MySQL계정]]></category>
		<category><![CDATA[MySQL모니터링]]></category>
		<category><![CDATA[MySQL백업]]></category>
		<category><![CDATA[MySQL버전]]></category>
		<category><![CDATA[MySQL복구]]></category>
		<category><![CDATA[MySQL상태]]></category>
		<category><![CDATA[MySQL서비스]]></category>
		<category><![CDATA[MySQL설정]]></category>
		<category><![CDATA[MySQL설치]]></category>
		<category><![CDATA[MySQL클라이언트]]></category>
		<category><![CDATA[MySQL튜토리얼]]></category>
		<category><![CDATA[MySQL팁]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[Port Number]]></category>
		<category><![CDATA[privilege management]]></category>
		<category><![CDATA[privileges]]></category>
		<category><![CDATA[problem solving]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[PROCESSLIST]]></category>
		<category><![CDATA[Production Environment]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[recovery]]></category>
		<category><![CDATA[Remote Access]]></category>
		<category><![CDATA[remote connection]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[REVOKE]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[running queries]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[security settings]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[server administration]]></category>
		<category><![CDATA[server operation]]></category>
		<category><![CDATA[service management]]></category>
		<category><![CDATA[service restart]]></category>
		<category><![CDATA[service start]]></category>
		<category><![CDATA[service stop]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[Shell스크립트]]></category>
		<category><![CDATA[SHOW STATUS]]></category>
		<category><![CDATA[SHOW VARIABLES]]></category>
		<category><![CDATA[SHOWSTATUS]]></category>
		<category><![CDATA[SHOWVARIABLES]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL query]]></category>
		<category><![CDATA[SQL쿼리]]></category>
		<category><![CDATA[status check]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[superuser]]></category>
		<category><![CDATA[system engineer]]></category>
		<category><![CDATA[system management]]></category>
		<category><![CDATA[systemctl]]></category>
		<category><![CDATA[TABLE STATUS]]></category>
		<category><![CDATA[TABLESTATUS]]></category>
		<category><![CDATA[tech info]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[TUTORIAL]]></category>
		<category><![CDATA[ufw]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[user list]]></category>
		<category><![CDATA[User Management]]></category>
		<category><![CDATA[version check]]></category>
		<category><![CDATA[가이드]]></category>
		<category><![CDATA[개발]]></category>
		<category><![CDATA[개발자]]></category>
		<category><![CDATA[개발환경]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[관리]]></category>
		<category><![CDATA[권한]]></category>
		<category><![CDATA[권한관리]]></category>
		<category><![CDATA[기술정보]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[네트워크]]></category>
		<category><![CDATA[데브옵스]]></category>
		<category><![CDATA[데이터]]></category>
		<category><![CDATA[데이터마이그레이션]]></category>
		<category><![CDATA[데이터백업]]></category>
		<category><![CDATA[데이터베이스]]></category>
		<category><![CDATA[데이터베이스관리]]></category>
		<category><![CDATA[데이터베이스관리자]]></category>
		<category><![CDATA[데이터베이스목록]]></category>
		<category><![CDATA[데이터보안]]></category>
		<category><![CDATA[데이터복구]]></category>
		<category><![CDATA[디스크]]></category>
		<category><![CDATA[로그분석]]></category>
		<category><![CDATA[로컬접속]]></category>
		<category><![CDATA[리눅스]]></category>
		<category><![CDATA[리모트접속]]></category>
		<category><![CDATA[리소스]]></category>
		<category><![CDATA[리스닝]]></category>
		<category><![CDATA[마이SQL]]></category>
		<category><![CDATA[마이그레이션]]></category>
		<category><![CDATA[매뉴얼]]></category>
		<category><![CDATA[메모리]]></category>
		<category><![CDATA[명령어]]></category>
		<category><![CDATA[모니터링]]></category>
		<category><![CDATA[문제해결]]></category>
		<category><![CDATA[방화벽]]></category>
		<category><![CDATA[배치]]></category>
		<category><![CDATA[백업]]></category>
		<category><![CDATA[버전확인]]></category>
		<category><![CDATA[보안]]></category>
		<category><![CDATA[보안설정]]></category>
		<category><![CDATA[복구]]></category>
		<category><![CDATA[비밀번호]]></category>
		<category><![CDATA[사용자관리]]></category>
		<category><![CDATA[사용자목록]]></category>
		<category><![CDATA[상태확인]]></category>
		<category><![CDATA[서버]]></category>
		<category><![CDATA[서버관리]]></category>
		<category><![CDATA[서버구축]]></category>
		<category><![CDATA[서버마이그레이션]]></category>
		<category><![CDATA[서버운영]]></category>
		<category><![CDATA[서비스관리]]></category>
		<category><![CDATA[서비스시작]]></category>
		<category><![CDATA[서비스재시작]]></category>
		<category><![CDATA[서비스중지]]></category>
		<category><![CDATA[설정파일]]></category>
		<category><![CDATA[성능튜닝]]></category>
		<category><![CDATA[센토스]]></category>
		<category><![CDATA[쉘]]></category>
		<category><![CDATA[슈퍼유저]]></category>
		<category><![CDATA[스크립트]]></category>
		<category><![CDATA[스토리지]]></category>
		<category><![CDATA[시스템]]></category>
		<category><![CDATA[시스템관리]]></category>
		<category><![CDATA[시스템로그]]></category>
		<category><![CDATA[시스템엔지니어]]></category>
		<category><![CDATA[실행중인쿼리]]></category>
		<category><![CDATA[예약작업]]></category>
		<category><![CDATA[오류해결]]></category>
		<category><![CDATA[우분투]]></category>
		<category><![CDATA[운영]]></category>
		<category><![CDATA[운영환경]]></category>
		<category><![CDATA[원격접속]]></category>
		<category><![CDATA[유지보수]]></category>
		<category><![CDATA[일반사용자]]></category>
		<category><![CDATA[자동화]]></category>
		<category><![CDATA[정보]]></category>
		<category><![CDATA[커맨드라인]]></category>
		<category><![CDATA[쿼리]]></category>
		<category><![CDATA[터미널]]></category>
		<category><![CDATA[튜닝]]></category>
		<category><![CDATA[튜토리얼]]></category>
		<category><![CDATA[트러블슈팅]]></category>
		<category><![CDATA[패스워드]]></category>
		<category><![CDATA[포트]]></category>
		<category><![CDATA[포트번호]]></category>
		<category><![CDATA[프로덕션]]></category>
		<category><![CDATA[프로세스]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=40254</guid>

					<description><![CDATA[<p>MySQL 서비스 관리 명령어 상태 확인 서비스 시작 서비스 재시작 서비스 중지 부팅 시 자동 시작 설정 파일 추가 유용한 명령어 백업 및 복구</p>
<p>The post <a href="https://lycos7560.com/ubuntu/mysql-%ec%84%9c%eb%b9%84%ec%8a%a4-%ea%b4%80%eb%a6%ac-%eb%aa%85%eb%a0%b9%ec%96%b4-ubuntu/40254/">MySQL 서비스 관리 명령어 (Ubuntu)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-2c60eeae      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#mysql-서비스-관리-명령어" class="uagb-toc-link__trigger">MySQL 서비스 관리 명령어</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#상태-확인" class="uagb-toc-link__trigger">상태 확인</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#서비스-시작" class="uagb-toc-link__trigger">서비스 시작</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#서비스-재시작" class="uagb-toc-link__trigger">서비스 재시작</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#서비스-중지" class="uagb-toc-link__trigger">서비스 중지</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#부팅-시-자동-시작" class="uagb-toc-link__trigger">부팅 시 자동 시작</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#설정-파일" class="uagb-toc-link__trigger">설정 파일</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#추가-유용한-명령어" class="uagb-toc-link__trigger">추가 유용한 명령어</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#백업-및-복구" class="uagb-toc-link__trigger">백업 및 복구</a></ul></ol>					</div>
									</div>
				</div>
			


<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">MySQL 서비스 관리 명령어</h2>



<h3 class="wp-block-heading">상태 확인</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo systemctl status mysql</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">서비스 시작</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo systemctl start mysql</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">서비스 재시작</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 설정 변경 후 MySQL 재시작 필요
sudo systemctl restart mysql</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">서비스 중지</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo systemctl stop mysql</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">부팅 시 자동 시작</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 부팅 시 자동 시작 활성화
sudo systemctl enable mysql

# 부팅 시 자동 시작 비활성화
sudo systemctl disable mysql</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">설정 파일</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo cat /etc/mysql/my.cnf

# 현재 상태 정보 확인
mysql -u root -p -e "SHOW STATUS;"

# MySQL 클라이언트로 현재 설정 값 확인
mysql -u root -p -e "SHOW VARIABLES;"

# 특정 설정 값만 필터링해서 보기 (예: buffer_pool_size)
mysql -u root -p -e "SHOW VARIABLES LIKE '%buffer_pool_size%';"</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">추가 유용한 명령어</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># MySQL 프로세스 확인
ps aux | grep mysql

# MySQL 버전 확인
mysql -V
mysql -u root -p -e "SELECT version();"

# 사용자 목록 확인
mysql -u root -p -e "SELECT user, host FROM mysql.user;"

# 데이터베이스 목록 확인
mysql -u root -p -e "SHOW DATABASES;"

# 테이블 상태 확인
mysql -u root -p -e "SHOW TABLE STATUS;"

# 실행 중인 쿼리 확인
mysql -u root -p -e "SHOW PROCESSLIST;"</pre>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">백업 및 복구</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># 전체 데이터베이스 백업
sudo mysqldump -u root -p --all-databases > full_backup.sql

# 특정 데이터베이스 백업
sudo mysqldump -u root -p database_name > db_backup.sql

# 백업 파일로 복구
mysql -u root -p &lt; full_backup.sql</pre>
<p>The post <a href="https://lycos7560.com/ubuntu/mysql-%ec%84%9c%eb%b9%84%ec%8a%a4-%ea%b4%80%eb%a6%ac-%eb%aa%85%eb%a0%b9%ec%96%b4-ubuntu/40254/">MySQL 서비스 관리 명령어 (Ubuntu)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/ubuntu/mysql-%ec%84%9c%eb%b9%84%ec%8a%a4-%ea%b4%80%eb%a6%ac-%eb%aa%85%eb%a0%b9%ec%96%b4-ubuntu/40254/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>알고리즘 – 트라이(Trie) 자료구조</title>
		<link>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ed%8a%b8%eb%9d%bc%ec%9d%b4trie-%ec%9e%90%eb%a3%8c%ea%b5%ac%ec%a1%b0/33961/</link>
					<comments>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ed%8a%b8%eb%9d%bc%ec%9d%b4trie-%ec%9e%90%eb%a3%8c%ea%b5%ac%ec%a1%b0/33961/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 14 Mar 2023 02:37:19 +0000</pubDate>
				<category><![CDATA[기타]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[leaf node]]></category>
		<category><![CDATA[retrieval]]></category>
		<category><![CDATA[root node]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[Time Complexity]]></category>
		<category><![CDATA[tree]]></category>
		<category><![CDATA[Trie]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[구조]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[데이터]]></category>
		<category><![CDATA[시간 복잡도]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[자료]]></category>
		<category><![CDATA[자료 구조]]></category>
		<category><![CDATA[자료구조]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[트라이]]></category>
		<category><![CDATA[트라이(Trie)]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=33961</guid>

					<description><![CDATA[<p>트라이(Trie) 자료구조에 대한 글입니다.<br />
트라이(Trie)의 자료구조의 장점 및 단점, c++ 구현에 대하여 설명합니다. (This is an article about the Trie data structure.<br />
Explain the advantages and disadvantages of the data structure of Trie and the implementation of c++.)</p>
<p>The post <a href="https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ed%8a%b8%eb%9d%bc%ec%9d%b4trie-%ec%9e%90%eb%a3%8c%ea%b5%ac%ec%a1%b0/33961/">알고리즘 – 트라이(Trie) 자료구조</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-df0292cc      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#트라이trie" class="uagb-toc-link__trigger">트라이(Trie)?</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#트라이trie의-이점" class="uagb-toc-link__trigger">트라이(Trie)의 이점</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#트라이trie의-잠재적인-단점" class="uagb-toc-link__trigger">트라이(Trie)의 잠재적인 단점</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#트라이trie의-시간-복잡도" class="uagb-toc-link__trigger">트라이(Trie)의 시간 복잡도</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#트라이trie-구현-c" class="uagb-toc-link__trigger">트라이(Trie) 구현 (C++)</a></ul></ol>					</div>
									</div>
				</div>
			


<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">트라이(Trie)?</h1>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide"/>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">Trie data structure는 문자열을 효율적으로 저장하고 검색하는 데 사용되는 Tree와 유사한 데이터 구조입니다.</p>



<p class="has-medium-font-size wp-block-paragraph">&#8220;Trie&#8221;라는 이름은 &#8220;트리&#8221;와 비슷하게 발음되는 &#8220;retrieval,&#8221;이라는 단어에서 유래되었습니다.</p>



<p class="has-medium-font-size wp-block-paragraph">검색할 때 볼 수 있는&nbsp;<strong>자동완성 기능, 사전 검색 등 문자열을 탐색하는데 특화</strong>되어있는 자료구조입니다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="883" height="823" src="https://lycos7560.com/wp-content/uploads/2023/03/image-53.png" alt="" class="wp-image-33963" srcset="https://lycos7560.com/wp-content/uploads/2023/03/image-53.png 883w, https://lycos7560.com/wp-content/uploads/2023/03/image-53-300x280.png 300w, https://lycos7560.com/wp-content/uploads/2023/03/image-53-768x716.png 768w" sizes="(max-width: 883px) 100vw, 883px" /><figcaption class="wp-element-caption">https://ko.wikipedia.org/wiki/%ED%8A%B8%EB%9D%BC%EC%9D%B4_(%EC%BB%B4%ED%93%A8%ED%8C%85)</figcaption></figure>



<p class="has-medium-font-size wp-block-paragraph">&#8220;A&#8221;, &#8220;to&#8221;, &#8220;tea&#8221;, &#8220;ted&#8221;, &#8220;ten&#8221;, &#8220;i&#8221;, &#8220;in&#8221;, &#8220;inn&#8221;를 키로 둔 트라이. </p>



<p class="has-medium-font-size wp-block-paragraph">이 예제에는 모든 자식 노드가 알파벳 순으로 왼쪽에서 오른쪽으로 정렬되어 있지는 않다. (루트 노드와 &#8216;t&#8217; 노드)</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">Trie에서 각 node는 문자열의 단일 문자를 나타내고 node에서 나오는 가장자리는 문자열의 다음 문자를 나타냅니다. </p>



<p class="has-medium-font-size wp-block-paragraph">Trie의 각 문자열은 root node에서 leaf node까지의 경로로 표시됩니다. </p>



<p class="has-medium-font-size wp-block-paragraph">root node에는 연결된 문자가 없으며 각 leaf node는 데이터 세트의 전체 문자열을 나타냅니다.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">Trie는 특히 공통 접두사를 공유하는 문자열을 검색할 때 문자열을 효율적으로 저장하고 검색하는 데 자주 사용됩니다. </p>



<p class="has-medium-font-size wp-block-paragraph">예를 들어 Trie를 사용하여 단어 사전을 저장할 수 있습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">여기서 Trie의 각 node는 단어의 접두사를 나타냅니다. </p>



<p class="has-medium-font-size wp-block-paragraph">Trie를 root node에서 leaf node로 이동하면  leaf node와 관련된 전체 단어를 빠르게 검색할 수 있습니다.</p>



<div style="height:150px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">트라이(Trie)의 이점</h2>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:0;margin-bottom:0"/>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">1. 효율적인 접두사 검색</h3>



<p class="has-medium-font-size wp-block-paragraph">Trie는 특히 접두사 검색 쿼리에 효율적입니다. </p>



<p class="has-medium-font-size wp-block-paragraph">root node에서 접두사를 나타내는 node로 Trie를 순회하면 해당 접두사로 시작하는 데이터 세트의 모든 문자열을 검색할 수 있습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">이는 자동 완성, 맞춤법 검사기 및 검색 엔진과 같은 응용 프로그램에서 유용합니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">2. 공간 효율성</h3>



<p class="has-medium-font-size wp-block-paragraph">Trie는 해시 테이블과 같은 다른 데이터 구조에 비해 매우 공간 효율적일 수 있습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">문자열에 공통 접두사의 중복 저장을 방지하여 특히 문자열 수가 많은 데이터 세트의 경우 공간을 크게 절약할 수 있습니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">3. 빠른 삽입 및 삭제</h3>



<p class="has-medium-font-size wp-block-paragraph">Trie는 문자열의 빠른 삽입 및 삭제를 지원하며 최악의 경우 O(m)의 시간 복잡도(m 문자열의 길이)입니다. </p>



<p class="has-medium-font-size wp-block-paragraph">따라서 데이터 세트가 동적이며 자주 업데이트해야 하는 애플리케이션에서 유용합니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">4. 예측 텍스트 입력</h3>



<p class="has-medium-font-size wp-block-paragraph">Trie는 자동 완성 시스템을 구현하는 데 사용할 수 있습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">여기서 시스템은 사용자 입력을 기반으로 다음 단어나 구문을 제안합니다. </p>



<p class="has-medium-font-size wp-block-paragraph">자주 사용되는 단어와 구문의 Trie를 저장함으로써 </p>



<p class="has-medium-font-size wp-block-paragraph">시스템은 사용자의 현재 입력을 기반으로 가장 가능성이 높은 다음 단어를 제안할 수 있습니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">5. 낮은 메모리 오버헤드</h3>



<p class="has-medium-font-size wp-block-paragraph">Trie는 특히 ASCII 또는 유니코드와 같은 작은 문자 세트의 경우 메모리 오버헤드가 낮습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">따라서 임베디드 시스템 및 기타 메모리 제약 환경에서 사용하기에 적합합니다.</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">전반적으로 Trie 데이터 구조는 문자열의 데이터 세트를 효율적으로 저장하고 처리하기 위한 강력한 도구입니다. </p>



<p class="has-medium-font-size wp-block-paragraph">특히 기본 사용 사례가 접두사를 검색하거나 시퀀스의 다음 단어를 예측하는 경우에 그렇습니다.</p>



<div style="height:150px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">트라이(Trie)의 잠재적인 단점</h2>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:0;margin-bottom:0"/>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">1. 메모리 요구 사항</h3>



<p class="has-medium-font-size wp-block-paragraph">Trie는 특히 문자열이 길거나 문자 집합이 큰 경우 </p>



<p class="has-medium-font-size wp-block-paragraph">큰 문자열 데이터 세트를 저장하기 위해 상당한 양의 메모리를 요구할 수 있습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">이는 메모리 사용량이 중요한 환경이나 응용 프로그램에서의 사용을 제한할 수 있습니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">2. 접두사가 아닌 쿼리에 대한 느린 검색 시간</h3>



<p class="has-medium-font-size wp-block-paragraph">Trie는 접두사 검색 쿼리에 효율적이지만 접두사가 아닌 쿼리에 대한 다른 데이터 구조보다 느릴 수 있습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">알고리즘이 쿼리와 일치하는 모든 문자열을 찾기 위해 각 노드의 전체 하위 트리를 탐색해야 하므로 </p>



<p class="has-medium-font-size wp-block-paragraph">해시 테이블과 같은 다른 데이터 구조에 비해 검색 시간이 느려질 수 있기 때문입니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">3. 복잡성</h3>



<p class="has-medium-font-size wp-block-paragraph">Trie 데이터 구조의 구현 및 유지 관리는 </p>



<p class="has-medium-font-size wp-block-paragraph">엄청나게 큰 데이터 세트의 경우 또는 문자 집합이 매우 복잡한 경우에</p>



<p class="has-medium-font-size wp-block-paragraph">다른 데이터 구조보다 더 복잡할 수 있습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">이로 인해 개발 시간이 길어지고 개발 비용이 높아질 수 있습니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">4. 희소 데이터 집합에 대한 비효율적인 메모리 사용</h3>



<p class="has-medium-font-size wp-block-paragraph">데이터 집합에 희소 문자열이 많이 포함되어 있거나 공통 접두사가 거의 없는 경우 </p>



<p class="has-medium-font-size wp-block-paragraph">Trie는 가장 메모리 효율적인 데이터 구조가 아닐 수 있습니다. </p>



<p class="has-medium-font-size wp-block-paragraph">이는 Trie가 많은 빈 노드를 저장해야 하므로 메모리가 낭비될 수 있기 때문입니다.</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">전반적으로 Trie 데이터 구조는 효율적인 문자열 처리를 위한 강력한 도구이지만 </p>



<p class="has-medium-font-size wp-block-paragraph">응용 프로그램의 특정 요구 사항에 따라 항상 최선의 선택이 아닐 수도 있습니다.</p>



<div style="height:150px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">트라이(Trie)의 시간 복잡도</h2>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:0;margin-bottom:0"/>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">일반적으로 Trie의 생성 시간 복잡도는 O(M x L), 탐색 시간 복잡도는 O(L)이다.</p>



<p class="has-medium-font-size wp-block-paragraph">제일 긴 문자열의 길이를 L이라 하고, 총 문자열들의 수를 M이라 할 때 시간 복잡도는 위와 같다.</p>



<p class="has-medium-font-size wp-block-paragraph">생성 시간 복잡도는 모든 문자열 M 개를 넣어야 하고, </p>



<p class="has-medium-font-size wp-block-paragraph">M 개에 대해서 트라이에 넣는 건 가장 긴 문자열 길이인 L 만큼 걸리므로 O(MxL)의 시간 복잡도를 가진다. (삽입은 O(L)이다.)</p>



<p class="has-medium-font-size wp-block-paragraph">탐색 시간 복잡도는 트리를 제일 깊게 탐색하는 경우는 가장 긴 문자열 길이인 L까지 깊게 들어가는 것이므로 O(L)의 시간 복잡도를 가진다.</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-default" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">트라이(Trie) 구현 (C++)</h2>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>
#include &lt;unordered_map>

using namespace std;

// TrieNode클래스를 사용하여 Trie의 각 노드를 표현
class TrieNode {

public:
    unordered_map&lt;char, TrieNode*> children;
    bool isEndOfWord;

    TrieNode() { 
        isEndOfWord = false;
    }
    
};

// Trie 클래스
class Trie {

    // Trie의 루트 노드에 대한 포인터인 Trie개인 멤버 변수
    private: 
        TrieNode* root; // 루트 노드

// 생성자새 인스턴스를 만들고 Trie를 초기화합
    public:
        Trie() {
            root = new TrieNode();
        }


    // 문자열을 받아 Trie에 추가합니다. 
    // 루트 노드에서 시작하여 Trie 아래로 이동하여 단어의 각 문자에 필요한 새 노드를 만듭니다.
    void insert(string word) {
        TrieNode* curr = root; // 시작
        for (char c : word) {
            if (curr->children.find(c) == curr->children.end()) {
                // Trie에 없다면 새 노드 생성
                curr->children[c] = new TrieNode();
            }
            curr = curr->children[c]; // Trie에 이미 존재하는 경우 기존 노드로 이동
        }
        // 단어의 끝을 나타내는 isEndOfWord bool값
        curr->isEndOfWord = true;
    }

    // 단어를 검색합니다.
    bool search(string word) {
        TrieNode* curr = root;
        for (char c : word) {
            if (curr->children.find(c) == curr->children.end()) {
                return false;
            }
            curr = curr->children[c];
        }
        return curr->isEndOfWord;
    }

    // prefix(접두사)로 시작하는 단어가 Trie에 있는지 확인
    bool startsWith(string prefix) {
        TrieNode* curr = root;
        for (char c : prefix) {
            if (curr->children.find(c) == curr->children.end()) {
                return false;
            }
            curr = curr->children[c];
        }
        return true;
    }
};

int main() {

    Trie trie;
    trie.insert("hello");
    trie.insert("world");
    trie.insert("hello world");

    cout &lt;&lt; trie.search("hello") &lt;&lt; "\n";      // output: 1 (true)
    cout &lt;&lt; trie.search("hello world") &lt;&lt; "\n"; // output: 1 (true)
    cout &lt;&lt; trie.search("hi") &lt;&lt; "\n";         // output: 0 (false)

    cout &lt;&lt; trie.startsWith("hell") &lt;&lt; "\n";    // output: 1 (true)
    cout &lt;&lt; trie.startsWith("heaven") &lt;&lt; "\n";  // output: 0 (false)

    return 0;
}</pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<figure class="wp-block-embed is-type-wp-embed is-provider-어제와-내일의-나-그-사이의-이야기 wp-block-embed-어제와-내일의-나-그-사이의-이야기"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="UKL9lnwUUR"><a href="https://lycos7560.com/cpp/programmers/programmers-17685-3%ec%b0%a8-%ec%9e%90%eb%8f%99%ec%99%84%ec%84%b1-2018-kakao-blind-recruitment/33995/">Programmers 17685 [3차] 자동완성 [2018 KAKAO BLIND RECRUITMENT]</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;Programmers 17685 [3차] 자동완성 [2018 KAKAO BLIND RECRUITMENT]&#8221; &#8212; 어제와 내일의 나 그 사이의 이야기" src="https://lycos7560.com/cpp/programmers/programmers-17685-3%ec%b0%a8-%ec%9e%90%eb%8f%99%ec%99%84%ec%84%b1-2018-kakao-blind-recruitment/33995/embed/#?secret=0L39VdZa1Y#?secret=UKL9lnwUUR" data-secret="UKL9lnwUUR" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;string>
#include &lt;vector>
#include &lt;unordered_map>

using namespace std;

// TrieNode클래스를 사용하여 Trie의 각 노드를 표현
class TrieNode {
public:
    unordered_map&lt;char, TrieNode*> children;
    int num; // 연관된 단어의 개수를 저장
    TrieNode() {
        num = 0;
    }
};

// Trie 클래스
class Trie {

private: // Trie의 루트 노드에 대한 포인터인 Trie개인 멤버 변수
    TrieNode* root; // 루트 노드


public:
    Trie() { // 생성자새 인스턴스를 만들고 Trie를 초기화
        root = new TrieNode();
    }

    // 문자열을 받아 Trie에 추가합니다. 
    // 루트 노드에서 시작하여 Trie 아래로 이동하여 단어의 각 문자에 필요한 새 노드를 만듭니다.
    void insert(string word) {
        TrieNode* curr = root; // 시작
        for (char c : word) {
            if (curr->children.find(c) == curr->children.end()) {
                // Trie에 없다면 새 노드 생성
                curr->children[c] = new TrieNode();
            }

            // Trie에 이미 존재하는 경우 기존 노드로 이동
            curr = curr->children[c];
            curr->num++; // 연관된 단어의 개수 추가
        }
    }

    // 단어를 검색합니다.
    // 연관된 단어의 개수가 1이라면 글자수 반환
    int search(string word) {
        TrieNode* curr = root;
        int cnt = 0;
        for (char c : word) {
            curr = curr->children[c];
            cnt++;
            if (curr->num == 1) {
                // 연관된 단어의 개수가 1이라면 
                // 자동완성
                return cnt;
            }
        }
        return 9999; // 문제에서 나올 수 없는 경우 
    }

    // prefix(접두사)로 시작하는 단어가 Trie에 있는지 확인
    int startsWith(string prefix) {
        TrieNode* curr = root;
        for (char c : prefix) {
            if (curr->children.find(c) == curr->children.end()) {
                return false;
            }
            curr = curr->children[c];
        }
        return curr->children.size();
    }

};

int solution(vector&lt;string> words) {
    int answer = 0;
    Trie trie;
    for (auto&amp; it : words) {
        trie.insert(it);
    }

    for (auto&amp; it : words) {
        if (trie.startsWith(it) >= 1) {
            // 접두사로 시작하는 단어가 있다면 
            // 단어 전체를 입력해야한다.
            answer += it.length();
            continue;
        }

        // 자동완성 확인
        answer += trie.search(it);
    }

    return answer;
}</pre>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--70);margin-bottom:var(--wp--preset--spacing--70)"/>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph"><a href="https://www.acmicpc.net/problemset?sort=ac_desc&amp;algo=79">https://www.acmicpc.net/problemset?sort=ac_desc&amp;algo=79</a> &lt;- 트라이 연습 문제 모음</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ed%8a%b8%eb%9d%bc%ec%9d%b4trie-%ec%9e%90%eb%a3%8c%ea%b5%ac%ec%a1%b0/33961/">알고리즘 – 트라이(Trie) 자료구조</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ed%8a%b8%eb%9d%bc%ec%9d%b4trie-%ec%9e%90%eb%a3%8c%ea%b5%ac%ec%a1%b0/33961/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>알고리즘 – 빅오 표기법(Big-O Notation) 정리</title>
		<link>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%eb%b9%85%ec%98%a4-%ed%91%9c%ea%b8%b0%eb%b2%95big-o-notation-%ec%a0%95%eb%a6%ac/5053/</link>
					<comments>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%eb%b9%85%ec%98%a4-%ed%91%9c%ea%b8%b0%eb%b2%95big-o-notation-%ec%a0%95%eb%a6%ac/5053/#comments</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 20 Jan 2023 02:19:48 +0000</pubDate>
				<category><![CDATA[기타]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[Average Case Analysis]]></category>
		<category><![CDATA[Best Case Analysis]]></category>
		<category><![CDATA[Big-O]]></category>
		<category><![CDATA[Big-O Notation]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[Time Complexity]]></category>
		<category><![CDATA[Worst Case Analysis]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[관리]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[데이터]]></category>
		<category><![CDATA[분석]]></category>
		<category><![CDATA[빅-오]]></category>
		<category><![CDATA[빅오 표기법]]></category>
		<category><![CDATA[생산성]]></category>
		<category><![CDATA[시간복잡도]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[알고리즘을 분석하는 이유]]></category>
		<category><![CDATA[정리]]></category>
		<category><![CDATA[참조]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[테스트]]></category>
		<category><![CDATA[해결]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=5053</guid>

					<description><![CDATA[<p>빅오 표기법(Big-O Notation)을 정리한 글입니다.</p>
<p>The post <a href="https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%eb%b9%85%ec%98%a4-%ed%91%9c%ea%b8%b0%eb%b2%95big-o-notation-%ec%a0%95%eb%a6%ac/5053/">알고리즘 – 빅오 표기법(Big-O Notation) 정리</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1152" height="640" src="https://lycos7560.com/wp-content/uploads/image-1023.png" alt="" class="wp-image-5194" srcset="https://lycos7560.com/wp-content/uploads/image-1023.png 1152w, https://lycos7560.com/wp-content/uploads/image-1023-300x167.png 300w, https://lycos7560.com/wp-content/uploads/image-1023-768x427.png 768w" sizes="(max-width: 1152px) 100vw, 1152px" /></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">시간 복잡도 / 공간 복잡도</h2>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">상황에 맞는 좋은 알고리즘을 선택하기 위해서는 알고리즘의 효율성을 확인해야 한다.</p>



<p class="has-medium-font-size wp-block-paragraph">이 때  효율성 측정에는 시간 복잡도(time complexity)와 공간 복잡도(space complexity)라는 두 부분이 있다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph"><strong>시간 복잡도</strong>는 문제를 해결하는데 걸리는 시간과 입력의 함수 관계</p>



<p class="has-medium-font-size wp-block-paragraph"><strong>공간 복잡도</strong>는 문제를 해결하는데 필요로 하는 자원 공간의 양</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Big-O 표기법 (Big-O Notation)</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">시간 복잡도의 표기법은</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph"><strong>최선 경우 분석(Best Case Analysis)</strong>&nbsp;=&gt; Big-Ω(빅-오메가) / 하한 점근 </p>



<p class="has-medium-font-size wp-block-paragraph">-&gt; 알고리즘&nbsp;<strong>최상</strong>의 실행 시간을 표기한다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph"><strong>최악 경우 분석(Worst Case Analysis)</strong>&nbsp;=&gt; Big-O(빅-오) / 상한 점근</p>



<p class="has-medium-font-size wp-block-paragraph">-&gt; 알고리즘&nbsp;<strong>최악</strong>의 실행 시간을 표기한다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph"><strong>평균 경우 분석(Average Case Analysis)</strong>&nbsp;=&gt; Big-θ(빅-세타) / 그 둘의 평균</p>



<p class="has-medium-font-size wp-block-paragraph">-&gt; 알고리즘&nbsp;<strong>평균</strong>&nbsp;실행 시간을 표기한다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">일반적으로 위의 3가지 경우로 분류한다.</p>



<p class="has-medium-font-size wp-block-paragraph">그중에서 <strong>Big-O 표기법은 최소한 보장되는 성능을 표기하기 때문에 가장 많이 사용하는 표기법</strong>이다.</p>



<p class="has-medium-font-size wp-block-paragraph">(불확실성을 제거하기 위해 최악의 경우를 사용)</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/image-1008.png" alt="" class="wp-image-5094" width="800" height="500"/></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-large-font-size wp-block-paragraph"><strong>O(1) &lt; O(logN) &lt; O(N) &lt; O(N logN) &lt; O(N²) &lt; O(2ᴺ) &lt; O(N!)</strong></p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">O(1) &#8211; 상수 시간 (Constant<strong> Time</strong>)</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">입력한 데이터의 크기에 상관없이 언제나 일정한 시간이 걸리는 알고리즘</p>



<p class="has-medium-font-size wp-block-paragraph">O(1) 알고리즘은 데이터(data)가 증가해도, 처리속도(time)에는 변함이 없는 알고리즘이다.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>

using namespace std;

int main()
{
	cout &lt;&lt; "Do Something!!";

	return 0;
}</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>

using namespace std;

int main()
{
	cout &lt;&lt; "Do Something!!";
	cout &lt;&lt; "Do Something!!";

	return 0;
}</pre>



<div style="height:42px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">두번 출력을 하는 코드는 O(2)가 아닌 O(1)이다.</p>



<p class="has-medium-font-size wp-block-paragraph">왜냐하면 Big O는 함수의 디테일에는 관심이 없기 때문이다.</p>



<p class="has-medium-font-size wp-block-paragraph">그저 input 사이즈에 따라서 달라진다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/image-1000.png" alt="" class="wp-image-5063" width="800" height="500"/></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">O(N) &#8211; 선형 시간 (Linear<strong> Time</strong>)</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">O(N)는 완벽한 대각선</p>



<p class="has-medium-font-size wp-block-paragraph">최악의 경우에 n번의 연산을 수행해야 하는 알고리즘으로 데이터가 추가될 때마다 알고리즘이 한 단계 더 진행된다.</p>



<p class="has-medium-font-size wp-block-paragraph">이것이 선형 시간이라고 하는 이유</p>



<p class="has-medium-font-size wp-block-paragraph">ex) 1중 for문</p>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>

using namespace std;

int main()
{
	int N = 0;
	cin >> N;
	for (int i = 0; i &lt; N; i++) {
		cout &lt;&lt; "Do Something!!" &lt;&lt; "\n";
	}

	return 0;
}</pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/image-1001.png" alt="" class="wp-image-5064" width="800" height="500"/></figure>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h2 class="wp-block-heading">* 참고 * O(1) / O(N)</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<div style="height:24px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">O(1)과 O(N)의 알고리즘으로 같은 문제를 50까지 수행한다면</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/image-1002.png" alt="" class="wp-image-5070" width="800" height="500"/></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">→ 입력 배열의 요소가 50개 미만일 때 O(N)가 더 효율적</p>



<p class="has-medium-font-size wp-block-paragraph">→ 정확히 50개의 요소에서 두 알고리즘은 동일한 단계 수를 사용</p>



<p class="has-medium-font-size wp-block-paragraph">→ 데이터가 증가할수록 O(N)더 많은 단계가 필요</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">Big-O 표기법은 데이터가 무한대로 커짐에 따라 알고리즘이 어떻게 수행되는지 살펴보기 때문에 </p>



<p class="has-medium-font-size wp-block-paragraph">O(N)가 보다 덜 효율적인 것으로 간주되는 이유다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">O(N²) &#8211;<strong> 2차 시간</strong> (<strong>Quadratic Time</strong>)</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">성능이 입력 요소 크기의 제곱에 비례하는 알고리즘의 복잡성을 나타낸다.&nbsp;일반적으로 매우 느리다.</p>



<p class="has-medium-font-size wp-block-paragraph">주로 <strong>중첩 반복</strong>이 있을 때 발생하게 된다.</p>



<p class="has-medium-font-size wp-block-paragraph">루프안에서 루프가 실행된다면, 20개의 데이터는 400개의 스텝이 된다. O(n^2)</p>



<p class="has-medium-font-size wp-block-paragraph">ex) 2중 for문, 삽입(Insertion)/거품(Bubble)/선택(Selection) 정렬 등&#8230;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>

using namespace std;

int main()
{
	int N = 0;
	cin >> N;
	for (int i = 0; i &lt; N; i++) {
		for (int j = 0; j &lt; N; j++) {
			cout &lt;&lt; "Do Something!!" &lt;&lt; "\n";
		}
	}

	return 0;
}</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/image-1004.png" alt="" class="wp-image-5078" width="800" height="500"/></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">O(logN) &#8211; <strong>로그 시간 (Logarithmic<strong> Time</strong>)</strong></h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">연산이 한 번 실행될 때 마다 데이터의 크기가 절반 감소하는 알고리즘 (log의 지수는 항상 2)</p>



<p class="has-medium-font-size wp-block-paragraph">데이터의 관점으로 말하면 O(logN)은 <strong>데이터가 두 배가 될 때마다 작업 수가 하나씩 증가</strong>한다.</p>



<p class="has-medium-font-size wp-block-paragraph">ex) binary search 알고리즘, tree 형태 자료구조 탐색</p>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 이진 탐색

int BinarySearch(int arr[], int size, int target)
{
	
	int low = 0;
	int high = size - 1;
	int mid = 0;

	while (low &lt;= high)
	{
		mid = (low + high) / 2;

		if (target &lt; arr[mid])
			high = mid - 1;
		else if (target > arr[mid])
			low = mid + 1;
		else
			return mid;  // 반환 값은 인덱스
	}

	return -1;
}</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/image-1005.png" alt="" class="wp-image-5081" width="800" height="500"/></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">O(N logN) &#8211; 로그 선형 시간 (Log-linear<strong><strong> Time</strong></strong>)</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">O(N)의 알고리즘과 O(log N)의 알고리즘이 중첩된 형태</p>



<p class="has-medium-font-size wp-block-paragraph">log(N)작업 N시간을 수행</p>



<p class="has-medium-font-size wp-block-paragraph">ex) 퀵(Quick) / 병합(Merge) / 힙(Heap) 정렬, 분할 정복 알고리즘</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">O(2ᴺ) &#8211; 지수 시간 (Exponential Time)</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">매우 느린 시간 복잡도로 주로 재귀적으로 수행하는 알고리즘이 이에 해당</p>



<p class="has-medium-font-size wp-block-paragraph">ex) fibonacci 수열</p>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">// 피보나치 수열 
int Fibonaci(int n){
    if (n == 1) return 0;
    else if (n == 2) return 1;
    else return Fibo(n - 1) + Fibo(n - 2);
}</pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">O(N!) &#8211; 계승 시간(Factorial Time)</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">&nbsp;입력 크기의 계승에 비례하는 실행 시간 </p>



<p class="has-medium-font-size wp-block-paragraph">가장 느린 알고리즘으로 입력 값이 조금만 커져도 계산이 어렵다. (답없다.)</p>



<div style="height:41px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading" id="빅오-표기법big-o-notation-특징">빅오 표기법(big-O notation)&nbsp;규칙</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading" id="계수-법칙-상수를-제거하라">계수 법칙: 상수를 제거하라</h3>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">계수 법칙은 단순히 입력 크기와 연관되지 않은 상수를 전부 무시하는 것이다</p>



<p class="has-medium-font-size wp-block-paragraph">빅오에서 입력 크기가 클 때 계수를 무시할 수 있다</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">상수 k > 0 인 경우 f(n)이 O(g(n))이면,
kf(n)은 O(g(n)이다.
이 말은 즉, 5f(n)과 f(n)이 모두 동일한 O(f(n))이라는 빅오 표기법을 지님을 의미한다</pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading" id="합의-법칙-빅오를-더하라">합의 법칙: 빅오를 더하라</h3>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">합의 법칙은 시간 복잡도를 더할 수 있다는 것을 의미한다</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">f(n)이 O(h(n))이고 g(n)이 O(p(n))이라면
f(n)+g(n)은 O(h(n))+O(p(n))이다
이 때 주의해야할 점은 합의 법칙을 적용한 다음 계수 법칙을 적용해야한다는 점이다</pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading" id="곱의-법칙-빅오를-곱하라">곱의 법칙: 빅오를 곱하라</h3>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">곱의 법칙은 빅오가 어떤 식으로 곱해지는지에 관한 것이다</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">f(n)이 O(h(n))이고 g(n)이 O(p(n))이면
f(n)g(n)은 O(h(n)p(n))이다</pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading" id="다항-법칙-빅오의-k승">다항 법칙: 빅오의 k승</h3>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">다항 법칙은 다항 시간 복잡도가 동일한 다항 차수를 지닌 빅오 표기법을 지님을 의미한다</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">f(n)이 k차 다항식이면 f(n)은 O(nᵏ)이다</pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">쉽게 말해, 빅오 표기법은 제일 영향력 있는 것만 신경쓰겠다는 의미</p>



<p class="has-medium-font-size wp-block-paragraph">(최고 차항을 남기고, 상수는 버린다)</p>



<p class="has-medium-font-size wp-block-paragraph">O(30n³+20n²+500n+3000)로 표시된 값이 있을 때, 빅오 표기법은 제일 영향력 있는 것만 남겨 O(n³)으로만 표기한다</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">참고 사이트</h2>



<div style="height:35px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph"><a href="https://velog.io/@2seunghye/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EB%B9%85%EC%98%A4%ED%91%9C%EA%B8%B0%EB%B2%95Big-O-notation" target="_blank" rel="noreferrer noopener">https://velog.io/@2seunghye/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EB%B9%85%EC%98%A4%ED%91%9C%EA%B8%B0%EB%B2%95Big-O-notation</a></p>



<p class="wp-block-paragraph"><a href="https://towardsdatascience.com/introduction-to-big-o-notation-820d2e25d3fd" target="_blank" rel="noreferrer noopener">https://towardsdatascience.com/introduction-to-big-o-notation-820d2e25d3fd</a></p>



<p class="wp-block-paragraph"><a href="https://wing-beat.tistory.com/17" target="_blank" rel="noreferrer noopener">https://wing-beat.tistory.com/17</a></p>



<p class="wp-block-paragraph"><a href="https://towardsdatascience.com/the-big-o-notation-d35d52f38134" target="_blank" rel="noreferrer noopener">https://towardsdatascience.com/the-big-o-notation-d35d52f38134</a></p>



<p class="wp-block-paragraph"><a href="https://noahlogs.tistory.com/27" target="_blank" rel="noreferrer noopener">https://noahlogs.tistory.com/27</a></p>



<p class="wp-block-paragraph"><a href="https://velog.io/@nana-moon/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EB%B9%85%EC%98%A4-%ED%91%9C%EA%B8%B0%EB%B2%95big-O-notation%EC%9D%B4%EB%9E%80" target="_blank" rel="noreferrer noopener">https://velog.io/@nana-moon/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EB%B9%85%EC%98%A4-%ED%91%9C%EA%B8%B0%EB%B2%95big-O-notation%EC%9D%B4%EB%9E%80</a></p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%eb%b9%85%ec%98%a4-%ed%91%9c%ea%b8%b0%eb%b2%95big-o-notation-%ec%a0%95%eb%a6%ac/5053/">알고리즘 – 빅오 표기법(Big-O Notation) 정리</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%eb%b9%85%ec%98%a4-%ed%91%9c%ea%b8%b0%eb%b2%95big-o-notation-%ec%a0%95%eb%a6%ac/5053/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>알고리즘 – 알고리즘 분석에 대한 정리</title>
		<link>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98%ec%9d%84-%eb%b6%84%ec%84%9d%ec%97%90-%eb%8c%80%ed%95%98%ec%97%ac/4978/</link>
					<comments>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98%ec%9d%84-%eb%b6%84%ec%84%9d%ec%97%90-%eb%8c%80%ed%95%98%ec%97%ac/4978/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Thu, 19 Jan 2023 19:15:08 +0000</pubDate>
				<category><![CDATA[기타]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[Average Case Analysis]]></category>
		<category><![CDATA[Best Case Analysis]]></category>
		<category><![CDATA[Big-O]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[Time Complexity]]></category>
		<category><![CDATA[Worst Case Analysis]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[관리]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[데이터]]></category>
		<category><![CDATA[분석]]></category>
		<category><![CDATA[빅-오]]></category>
		<category><![CDATA[생산성]]></category>
		<category><![CDATA[시간복잡도]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[알고리즘을 분석하는 이유]]></category>
		<category><![CDATA[참조]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[테스트]]></category>
		<category><![CDATA[해결]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=4978</guid>

					<description><![CDATA[<p>알고리즘을 공부하면서 공부한 내용을 정리한 글입니다. (This is an article that summarizes what you studied while studying algorithms.)</p>
<p>The post <a href="https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98%ec%9d%84-%eb%b6%84%ec%84%9d%ec%97%90-%eb%8c%80%ed%95%98%ec%97%ac/4978/">알고리즘 – 알고리즘 분석에 대한 정리</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">알고리즘을 분석하는 이유</h1>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>정확성 확인(무결성 확인)</strong></p>



<p class="has-medium-font-size wp-block-paragraph">모든 유효한 입력에 대해서 유한 시간 내에 올바른 해를 찾아내는가를 판단하기 위함</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>효율성 확인</strong></p>



<p class="has-medium-font-size wp-block-paragraph">한정된 자원(기억 장소 사용량, 수행 시간)에서 효율적으로 작동하는지 확인하기 위함</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>궁극적으로 알고리즘을 분석하여 얻는 이점</strong></p>



<p class="has-medium-font-size wp-block-paragraph">문제를 해결하기 위해 중요한 것과 중요하지 않은 것을 판단할 수 있다.</p>



<p class="has-medium-font-size wp-block-paragraph">문제를 단순화하여 생각할 수 있다.</p>



<p class="has-medium-font-size wp-block-paragraph">다른 사람의 아이디어에 대한 효율성을 판단할 수 있다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">같은 문제를 해결하는 알고리즘은 여러 가지가 존재한다.</p>



<p class="has-medium-font-size wp-block-paragraph">최상의 알고리즘은 존재하지 않으며 항상 주어진 상황을 객관적으로 분석하여 알고리즘을 선택해야 한다.</p>



<p class="has-medium-font-size wp-block-paragraph">또한 기존의 알고리즘을 개선하기 위해서 적용 가능한 여러 알고리즘을 객관적으로 비교 분석을 할 줄 알아야 한다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>알고리즘을 분석하는 방법</strong></p>



<p class="has-medium-font-size wp-block-paragraph">일반적으로 알고리즘의 수행 시간에 따른 <strong>시간복잡도(Time Complexity)</strong>와</p>



<p class="has-medium-font-size wp-block-paragraph">작성한 프로그램이 얼마나 많은 공간(메모리)을 차지하느냐를 분석하는 방법인 <strong>공간복잡도(Space&nbsp;Complexity)</strong>로 분석한다.</p>



<p class="has-medium-font-size wp-block-paragraph">시간복잡도의 경우 알고리즘을 잘못 구성하였을 경우 결과값이 나오지 않거나 현저하게 느린속도가 나오기에 </p>



<p class="has-medium-font-size wp-block-paragraph">공간복잡도보다는 시간복잡도를 우선시하여 프로그램을 분석한다. (기술의 발달로 인한 메모리 증가도 큰 영향)</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">알고리즘의 수행 시간</h1>



<p class="has-medium-font-size wp-block-paragraph">알고리즘의 효율성을 분석하는 방법은 다양하지만, 많은 경우에 알고리즘의 수행 시간을 이용하여 효율성을 분석</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>시간복잡도</strong> <strong>(Time Complexity)</strong> : 얼마나 빠른가?</p>



<p class="has-medium-font-size wp-block-paragraph">입력 크기에 비례하여 작업시간이 어떠한 비율로 증가하는지 확인한다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>시간복잡도를 사용하는 이유</strong></p>



<p class="has-medium-font-size wp-block-paragraph">실측으로 시간을 측정하는 경우 프로그래밍 언어, 컴퓨터의 성능, 프로그래머의 실력 등의 다양한 변수에 따라 달라질 수 있다.</p>



<p class="has-medium-font-size wp-block-paragraph">(분석에 객관적인 기준이 필요)</p>



<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-large-font-size wp-block-paragraph"><strong>수행 시간 분석 방법</strong></p>



<p class="wp-block-paragraph" style="font-size:30px"><strong>최선 경우 분석(Best Case Analysis)</strong> =&gt; Big-Ω(빅-오메가) / 하한 점근</p>



<p class="has-medium-font-size wp-block-paragraph">최선의 경우는 프로그램 실행 시간의 하한을 계산한다. </p>



<p class="has-medium-font-size wp-block-paragraph">선형 탐색의 경우 베스트 케이스는 찾으려는 x가 제일 처음에 위치하는 경우이다. </p>



<p class="has-medium-font-size wp-block-paragraph">최상의 경우 실행되는 연산의 수는 상수이며 입력 크기 n에 영향을 받지 않는다. </p>



<p class="has-medium-font-size wp-block-paragraph">따라서 최상의 경우 시간 복잡도는&nbsp;θ(1)이다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>최악 경우 분석(Worst Case Analysis)</strong> =&gt; Big-O(빅-오) / 상한 점근</p>



<p class="has-medium-font-size wp-block-paragraph">최악의 경우는 알고리즘이 실행되는 시간의 상한을 결정한다. </p>



<p class="has-medium-font-size wp-block-paragraph">프로그램을 실행 할 때 연산이 수행되는 횟수가 최대가 되는 경우이다. </p>



<p class="has-medium-font-size wp-block-paragraph">선형 탐색의 경우 찾으려는 원소가 배열에 존재하지 않거나 배열의 끝에 존재하는 경우이다. </p>



<p class="has-medium-font-size wp-block-paragraph">배열에 찾으려는 원소가 존재하지 않으면 배열의 전체 원소와 모두 비교를 한다.</p>



<p class="has-medium-font-size wp-block-paragraph">이 때 최악이라는 것은 단위 연산이 수행되는 횟수가 최대라는 것이다. </p>



<p class="has-medium-font-size wp-block-paragraph">입력 크기와 입력 값(내용) 모두에 종속된다. </p>



<p class="has-medium-font-size wp-block-paragraph">선형 탐색의 최악의 경우 시간 복잡도는 θ(n)이다.​</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/image-995.png" alt="" class="wp-image-5016" width="541" height="424" srcset="https://lycos7560.com/wp-content/uploads/image-995.png 1013w, https://lycos7560.com/wp-content/uploads/image-995-300x235.png 300w, https://lycos7560.com/wp-content/uploads/image-995-768x601.png 768w" sizes="(max-width: 541px) 100vw, 541px" /></figure>



<figure class="wp-block-embed is-type-wp-embed is-provider-어제와-내일의-나-그-사이의-이야기 wp-block-embed-어제와-내일의-나-그-사이의-이야기"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="LLu30oHh8G"><a href="https://lycos7560.com/?p=5053">알고리즘 – 빅오 표기법(Big-O Notation) 정리</a></blockquote><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;알고리즘 – 빅오 표기법(Big-O Notation) 정리&#8221; &#8212; 어제와 내일의 나 그 사이의 이야기" src="https://lycos7560.com/?p=5053&#038;embed=true#?secret=90kjAk5LHm#?secret=LLu30oHh8G" data-secret="LLu30oHh8G" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<div style="height:80px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>평균 경우 분석(Average Case Analysis)</strong> =&gt; Big-θ(빅-세타) / 그 둘의 평균</p>



<p class="has-medium-font-size wp-block-paragraph">평균적인 경우를 계산하는 방법은 다음과 같다. </p>



<p class="has-medium-font-size wp-block-paragraph">가능한 모든 입력에 대해 실행 시간을 계산한다. </p>



<p class="has-medium-font-size wp-block-paragraph">그리고 이 시간을 모두 더하고, 더한 결과를 입력의 수로 나눈다.</p>



<p class="has-medium-font-size wp-block-paragraph">선형 탐색을 계산하는 방법은 다음과 같다.</p>



<p class="has-medium-font-size wp-block-paragraph">선형 탐색인 경우 모든 경우들이 균등하게 분포한다고 가정하자.</p>



<p class="has-medium-font-size wp-block-paragraph">크기 n의 배열에서 원소 x를 찾으려고 할 때, x의 위치는 1 또는 2, 3, … , n이 될 수 있다.</p>



<p class="has-medium-font-size wp-block-paragraph">배열을 따라 각 원소를 x와 비교한다. </p>



<p class="has-medium-font-size wp-block-paragraph">만약 배열의 k번째 원소에 도달 했으면 이미 k번 비교를 한 것이다.</p>



<p class="has-medium-font-size wp-block-paragraph">x가 인덱스 1의 위치에 있다면 1번 비교한다.</p>



<p class="has-medium-font-size wp-block-paragraph">x가 인덱스 2의 위치에 있다면 2번 비교한다.</p>



<p class="has-medium-font-size wp-block-paragraph">…</p>



<p class="has-medium-font-size wp-block-paragraph">x가 인덱스 n의 위치에 있다면 n번 비교한다.</p>



<p class="has-medium-font-size wp-block-paragraph">평균을 구하기 위해 비교한 수들을 합하면  1+ 2 + 3 + &#8230; + n = (n+1)n / 2  </p>



<p class="has-medium-font-size wp-block-paragraph">이를 배열의 크기인 n으로 나누면 (n+1) / 2 이다.</p>



<p class="has-medium-font-size wp-block-paragraph">따라서 선형 탐색의 평균 시간 복잡도는 θ(n) 이다.</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-large-font-size wp-block-paragraph"><strong>가장 자주 사용되는</strong> <strong>분석</strong></p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph" style="font-size:30px"><strong>최악 경우 분석(Worst Case Analysis)</strong> =&gt; <strong>Big-O(빅-오)</strong><em> </em>/ 상한 점근</p>



<p class="has-medium-font-size wp-block-paragraph">시간 복잡도에는 여러 개념이 있지만 그중에서 </p>



<p class="has-medium-font-size wp-block-paragraph">‘아무리 많이 걸려도 이 시간 안에는 끝날 것‘의 개념이 제일 중요하다.&nbsp;</p>



<p class="has-medium-font-size wp-block-paragraph">예를 들어 동전을 튕겨서 뒷면이 나올 확률을 이야기해본다면 운이 좋으면 한 번에 뒷면이 나올 수도 있고 </p>



<p class="has-medium-font-size wp-block-paragraph">운이 좋지 않으면 3번 4번만에 뒷면이 나올수도 있다.</p>



<p class="has-medium-font-size wp-block-paragraph">운이 나쁜 경우 n번만큼 동전을 튕겨야 하는 최악의 경우가 발생하는데 </p>



<p class="has-medium-font-size wp-block-paragraph">이&nbsp;최악의 경우를 계산하는 방식을&nbsp;<strong>빅-오(Big-O) 표기법</strong>이라고 부르며 이 방식을 가장 많이 사용한다.</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98%ec%9d%84-%eb%b6%84%ec%84%9d%ec%97%90-%eb%8c%80%ed%95%98%ec%97%ac/4978/">알고리즘 – 알고리즘 분석에 대한 정리</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/etc/%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98%ec%9d%84-%eb%b6%84%ec%84%9d%ec%97%90-%eb%8c%80%ed%95%98%ec%97%ac/4978/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C++ 데이터 형식 범위 (Microsoft Visual C++)</title>
		<link>https://lycos7560.com/cpp/cpp-data-type-range/3766/</link>
					<comments>https://lycos7560.com/cpp/cpp-data-type-range/3766/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Mon, 02 Jan 2023 13:50:26 +0000</pubDate>
				<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[bit]]></category>
		<category><![CDATA[byte]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[double]]></category>
		<category><![CDATA[int]]></category>
		<category><![CDATA[long]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[signed]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[type]]></category>
		<category><![CDATA[unsigned]]></category>
		<category><![CDATA[Visual]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[데이터]]></category>
		<category><![CDATA[범위]]></category>
		<category><![CDATA[변수]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[오버플로우]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[타입]]></category>
		<category><![CDATA[형식]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=3766</guid>

					<description><![CDATA[<p>C++ 에서 사용하는 데이터 형식의 범위에 대한 글입니다. int, long, float, double 등 다양한 데이터 형식을 확인 할 수 있습니다. (A statement about the range of data types used by C++. You can check various data formats such as int, long, float, and double.)</p>
<p>The post <a href="https://lycos7560.com/cpp/cpp-data-type-range/3766/">C++ 데이터 형식 범위 (&lt;strong&gt;Microsoft Visual C++&lt;/strong&gt;)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671"
     crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-5698326622209671"
     data-ad-slot="6908948342"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">요약</h2>



<p class="has-medium-font-size wp-block-paragraph">코딩 테스트를 준비하면서 정리한 변수 자료형들의 범위 및 바이트 목록입니다.</p>



<p class="has-medium-font-size wp-block-paragraph">값의 범위를 어느 정도 인지하고 있어야 오버플로우를 막을 수 있습니다.</p>



<div style="height:39px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-table has-medium-font-size"><table><tbody><tr><td><strong>유형 이름</strong></td><td><strong>바이트</strong> <strong>(1byte = 8bit)</strong></td><td><strong>값의 범위</strong></td></tr><tr><td><strong>int</strong><br>signed int<br>long<br>long int<br>signed long<br>signed long int</td><td>4</td><td>–2,147,483,648 ~ 2,147,483,647 / [ -2<sup>31</sup> ~ (2<sup>31</sup> &#8211; 1) ]</td></tr><tr><td>unsigned<br>unsigned int<br>unsigned long <br>unsigned long int</td><td>4</td><td>0 ~ 4,294,967,295 / [ 0 ~ (2<sup>32</sup> &#8211; 1) ]</td></tr><tr><td><strong>bool</strong></td><td>1</td><td>false 또는 true (0 또는 1)</td></tr><tr><td><strong>char</strong><br>signed char</td><td>1</td><td>-128 ~ 127 / [ -2<sup>7</sup> ~ (2<sup>7</sup> &#8211; 1) ]</td></tr><tr><td>unsigned char</td><td>1</td><td>0 ~ 255 / [ 0 ~ (2<sup>8</sup> &#8211; 1) ]</td></tr><tr><td>short</td><td>2</td><td>–32,768 ~ 32,767 / [ -2<sup>15</sup> ~ (2<sup>15</sup> &#8211; 1) ]</td></tr><tr><td>unsigned short</td><td>2</td><td>0 ~ 65,535 / [ 0 ~ (2<sup>16</sup> &#8211; 1) ]</td></tr><tr><td><strong>long long</strong> <br>long long int <br>signed long long <br>signed long long int</td><td>8</td><td>–9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 / [ -2<sup>63</sup> ~ (2<sup>63</sup> &#8211; 1) ]</td></tr><tr><td><strong>unsigned long long</strong><br>unsigned long long int</td><td>8</td><td>0 ~ 18,446,744,073,709,551,615 / [ 0 ~ (2<sup>64</sup> &#8211; 1) ]</td></tr><tr><td><strong>float</strong></td><td>4</td><td>3.4E+/-38(7개의 자릿수) / [ (3.4 X 10^-38) ~ (3.4 X 10^38) ]</td></tr><tr><td><strong>double</strong><br>long double</td><td>8</td><td>1.7E+/-308(15개의 자릿수) / [ (1.7 X 10^-308) ~ (1.7 X 10^308) ]</td></tr></tbody></table></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading" style="font-size:35px"><strong><mark style="background-color:var(--ast-global-color-6)" class="has-inline-color has-ast-global-color-1-color"># int와 long은 다른 타입입니다.</mark></strong></h2>



<div style="height:27px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph"><a href="https://smallpants.tistory.com/10" target="_blank" rel="noreferrer noopener">https://smallpants.tistory.com/10</a>  &lt;- 참고</p>



<p class="has-medium-font-size wp-block-paragraph">long이 int보다 더 큰 범위를 보관할 수 있다고 보는 것은 옳지 않다.</p>



<p class="has-medium-font-size wp-block-paragraph">int는 운영체제의 환경(32bit, 64bit 등)에 맞는 크기로 사용되어 왔는데 </p>



<p class="has-medium-font-size wp-block-paragraph">아래와 같이 16비트 운영체제에서는 16비트로 사용되었고 </p>



<p class="has-medium-font-size wp-block-paragraph">32비트 운영체제에서는 32비트로 사용되었는데</p>



<p class="has-medium-font-size wp-block-paragraph">64비트 운영체제에서 int가 64비트가 되면 long보다 크기가 커지게 되므로 </p>



<p class="has-medium-font-size wp-block-paragraph">int가 아닌 long을 8바이트로 늘려서 사용하게 되었다고 한다.</p>



<p class="has-medium-font-size wp-block-paragraph">그러므로 32비트 기반으로 컴파일하게 되면 int와 long의 자료형의 길이는 같다.</p>



<p class="has-medium-font-size wp-block-paragraph">(windows의 경우 64비트로 컴파일해도 같다. 이유는 맨 아래에)</p>



<p class="has-medium-font-size wp-block-paragraph">16비트 운영체제</p>



<p class="has-medium-font-size wp-block-paragraph">&nbsp; &#8211; short : 16비트</p>



<p class="has-medium-font-size wp-block-paragraph">&nbsp; &#8211; int : 16비트</p>



<p class="has-medium-font-size wp-block-paragraph">  &#8211; long : 32비트</p>



<div style="height:34px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">32비트 운영체제&nbsp;</p>



<p class="has-medium-font-size wp-block-paragraph">&nbsp; &#8211; short : 16비트</p>



<p class="has-medium-font-size wp-block-paragraph">&nbsp; &#8211; int : 32비트</p>



<p class="has-medium-font-size wp-block-paragraph">  &#8211; long : 32비트</p>



<div style="height:35px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">64비트 운영체제&nbsp;</p>



<p class="has-medium-font-size wp-block-paragraph">&nbsp; &#8211; short : 16비트</p>



<p class="has-medium-font-size wp-block-paragraph">&nbsp; &#8211; int : 32비트</p>



<p class="has-medium-font-size wp-block-paragraph">  &#8211; long : 64비트</p>



<div style="height:46px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1478" height="189" src="https://lycos7560.com/wp-content/uploads/image-776.png" alt="" class="wp-image-3779" srcset="https://lycos7560.com/wp-content/uploads/image-776.png 1478w, https://lycos7560.com/wp-content/uploads/image-776-300x38.png 300w, https://lycos7560.com/wp-content/uploads/image-776-768x98.png 768w" sizes="(max-width: 1478px) 100vw, 1478px" /></figure>



<div style="height:45px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<div style="height:58px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="has-large-font-size wp-block-heading">MS 문서</h2>



<p class="has-medium-font-size wp-block-paragraph"><a href="https://learn.microsoft.com/ko-kr/cpp/cpp/data-type-ranges?view=msvc-170" target="_blank" rel="noreferrer noopener">https://learn.microsoft.com/ko-kr/cpp/cpp/data-type-ranges?view=msvc-170</a></p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">Microsoft C++ 32비트 및 64비트 컴파일러는 이 문서의 뒷부분에 있는 표의 형식을 인식합니다. </p>



<p class="has-medium-font-size wp-block-paragraph">int (unsigned int)</p>



<p class="has-medium-font-size wp-block-paragraph">__int8 (unsigned __int8)</p>



<p class="has-medium-font-size wp-block-paragraph">__int16 (unsigned __int16)</p>



<p class="has-medium-font-size wp-block-paragraph">__int32 (unsigned __int32)</p>



<p class="has-medium-font-size wp-block-paragraph">__int64 (unsigned __int64)</p>



<p class="has-medium-font-size wp-block-paragraph">short (unsigned short)</p>



<p class="has-medium-font-size wp-block-paragraph">long (unsigned long)</p>



<p class="has-medium-font-size wp-block-paragraph">long long (unsigned long long)</p>



<p class="has-medium-font-size wp-block-paragraph">이름이 두 개의 밑줄(__)로 시작하는 경우 데이터 형식은 비표준입니다.</p>



<p class="has-medium-font-size wp-block-paragraph">다음 표에 지정된 범위는 포함-포함입니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-table"><table><thead><tr><th class="has-text-align-left" data-align="left">유형 이름</th><th class="has-text-align-left" data-align="left">바이트</th><th class="has-text-align-left" data-align="left">기타 이름</th><th class="has-text-align-left" data-align="left">값의 범위</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left"><strong><code>int</code></strong></td><td class="has-text-align-left" data-align="left">4</td><td class="has-text-align-left" data-align="left"><strong><code>signed</code></strong></td><td class="has-text-align-left" data-align="left">–2,147,483,648 ~ 2,147,483,647</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned int</code></strong></td><td class="has-text-align-left" data-align="left">4</td><td class="has-text-align-left" data-align="left"><strong><code>unsigned</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 4,294,967,295</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>__int8</code></strong></td><td class="has-text-align-left" data-align="left">1</td><td class="has-text-align-left" data-align="left"><strong><code>char</code></strong></td><td class="has-text-align-left" data-align="left">-128 ~ 127</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned __int8</code></strong></td><td class="has-text-align-left" data-align="left">1</td><td class="has-text-align-left" data-align="left"><strong><code>unsigned char</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 255</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>__int16</code></strong></td><td class="has-text-align-left" data-align="left">2</td><td class="has-text-align-left" data-align="left"><strong><code>short</code></strong>,&nbsp;<strong><code>short int</code></strong>,&nbsp;<strong><code>signed short int</code></strong></td><td class="has-text-align-left" data-align="left">–32,768 ~ 32,767</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned __int16</code></strong></td><td class="has-text-align-left" data-align="left">2</td><td class="has-text-align-left" data-align="left"><strong><code>unsigned short</code></strong>,&nbsp;<strong><code>unsigned short int</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 65,535</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>__int32</code></strong></td><td class="has-text-align-left" data-align="left">4</td><td class="has-text-align-left" data-align="left"><strong><code>signed</code></strong>,&nbsp;<strong><code>signed int</code></strong>,&nbsp;<strong><code>int</code></strong></td><td class="has-text-align-left" data-align="left">–2,147,483,648 ~ 2,147,483,647</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned __int32</code></strong></td><td class="has-text-align-left" data-align="left">4</td><td class="has-text-align-left" data-align="left"><strong><code>unsigned</code></strong>,&nbsp;<strong><code>unsigned int</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 4,294,967,295</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>__int64</code></strong></td><td class="has-text-align-left" data-align="left">8</td><td class="has-text-align-left" data-align="left"><strong><code>long long</code></strong>,&nbsp;<strong><code>signed long long</code></strong></td><td class="has-text-align-left" data-align="left">–9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned __int64</code></strong></td><td class="has-text-align-left" data-align="left">8</td><td class="has-text-align-left" data-align="left"><strong><code>unsigned long long</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 18,446,744,073,709,551,615</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>bool</code></strong></td><td class="has-text-align-left" data-align="left">1</td><td class="has-text-align-left" data-align="left">없음</td><td class="has-text-align-left" data-align="left"><strong><code>false</code></strong>&nbsp;또는&nbsp;<strong><code>true</code></strong></td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>char</code></strong></td><td class="has-text-align-left" data-align="left">1</td><td class="has-text-align-left" data-align="left">없음</td><td class="has-text-align-left" data-align="left">기본적으로 -128에서 127까지 <br>를 사용하여 컴파일하는 경우 0~255 <a href="https://learn.microsoft.com/ko-kr/cpp/build/reference/j-default-char-type-is-unsigned?view=msvc-170" target="_blank" rel="noreferrer noopener"><code>/J</code></a></td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>signed char</code></strong></td><td class="has-text-align-left" data-align="left">1</td><td class="has-text-align-left" data-align="left">없음</td><td class="has-text-align-left" data-align="left">-128 ~ 127</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned char</code></strong></td><td class="has-text-align-left" data-align="left">1</td><td class="has-text-align-left" data-align="left">없음</td><td class="has-text-align-left" data-align="left">0 ~ 255</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>short</code></strong></td><td class="has-text-align-left" data-align="left">2</td><td class="has-text-align-left" data-align="left"><strong><code>short int</code></strong>,&nbsp;<strong><code>signed short int</code></strong></td><td class="has-text-align-left" data-align="left">–32,768 ~ 32,767</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned short</code></strong></td><td class="has-text-align-left" data-align="left">2</td><td class="has-text-align-left" data-align="left"><strong><code>unsigned short int</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 65,535</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>long</code></strong></td><td class="has-text-align-left" data-align="left">4</td><td class="has-text-align-left" data-align="left"><strong><code>long int</code></strong>,&nbsp;<strong><code>signed long int</code></strong></td><td class="has-text-align-left" data-align="left">–2,147,483,648 ~ 2,147,483,647</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned long</code></strong></td><td class="has-text-align-left" data-align="left">4</td><td class="has-text-align-left" data-align="left"><strong><code>unsigned long int</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 4,294,967,295</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>long long</code></strong></td><td class="has-text-align-left" data-align="left">8</td><td class="has-text-align-left" data-align="left">none(하지만 해당)<strong><code>__int64</code></strong></td><td class="has-text-align-left" data-align="left">–9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>unsigned long long</code></strong></td><td class="has-text-align-left" data-align="left">8</td><td class="has-text-align-left" data-align="left">none(하지만 해당)<strong><code>unsigned __int64</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 18,446,744,073,709,551,615</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>enum</code></strong></td><td class="has-text-align-left" data-align="left">다름</td><td class="has-text-align-left" data-align="left">없음</td><td class="has-text-align-left" data-align="left"></td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>float</code></strong></td><td class="has-text-align-left" data-align="left">4</td><td class="has-text-align-left" data-align="left">없음</td><td class="has-text-align-left" data-align="left">3.4E+/-38(7개의 자릿수)</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>double</code></strong></td><td class="has-text-align-left" data-align="left">8</td><td class="has-text-align-left" data-align="left">없음</td><td class="has-text-align-left" data-align="left">1.7E+/-308(15개의 자릿수)</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>long double</code></strong></td><td class="has-text-align-left" data-align="left">같기&nbsp;<strong><code>double</code></strong></td><td class="has-text-align-left" data-align="left">없음</td><td class="has-text-align-left" data-align="left"><strong><code>double</code></strong>과 동일</td></tr><tr><td class="has-text-align-left" data-align="left"><strong><code>wchar_t</code></strong></td><td class="has-text-align-left" data-align="left">2</td><td class="has-text-align-left" data-align="left"><strong><code>__wchar_t</code></strong></td><td class="has-text-align-left" data-align="left">0 ~ 65,535</td></tr></tbody></table></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph"><strong><code>__wchar_t</code></strong> 변수는 사용 방법에 따라 와이드 문자 형식 또는 멀티바이트 문자 형식을 지정합니다. </p>



<p class="has-medium-font-size wp-block-paragraph">문자 또는 문자열 상수 앞에 <code>L</code> 접두사를 사용하여 와이드 문자 형식 상수를 지정합니다.</p>



<p class="has-medium-font-size wp-block-paragraph"><strong><code>signed</code></strong> 및 <strong><code>unsigned</code></strong> 는 <strong><code>bool</code></strong>을 제외한 모든 정수 형식에서 사용할 수 있는 한정자입니다. </p>



<p class="has-medium-font-size wp-block-paragraph"><strong><code>char</code></strong>, <strong><code>signed char</code></strong> 및 <strong><code>unsigned char</code></strong>는 오버로드 및 템플릿과 같은 메커니즘에 사용되는 3가지 고유 형식입니다.</p>



<p class="has-medium-font-size wp-block-paragraph"><strong><code>int</code></strong> 및 <strong><code>unsigned int</code></strong> 형식의 크기는 4바이트입니다. </p>



<p class="has-medium-font-size wp-block-paragraph">그러나 언어 표준에서 구현 전용으로 허용되므로 이식 가능한 코드는 <strong><code>int</code></strong> 의 크기에 의존해서는 안 됩니다.</p>



<p class="has-medium-font-size wp-block-paragraph">Visual Studio의 C/C++에서도 크기가 지정된 정수 형식을 지원합니다. </p>



<p class="has-medium-font-size wp-block-paragraph">자세한 내용은 정수 제한 및 정<a href="https://learn.microsoft.com/ko-kr/cpp/cpp/integer-limits?view=msvc-170">수 제한을</a> 참조 <a href="https://learn.microsoft.com/ko-kr/cpp/cpp/int8-int16-int32-int64?view=msvc-170" target="_blank" rel="noreferrer noopener"><code>__int8, __int16, __int32, __int64</code></a> 하세요.</p>



<p class="has-medium-font-size wp-block-paragraph">각 형식의 크기 제한에 대한 자세한 내용은&nbsp;<a href="https://learn.microsoft.com/ko-kr/cpp/cpp/fundamental-types-cpp?view=msvc-170">기본 제공 형식</a>을 참조하세요.</p>



<p class="has-medium-font-size wp-block-paragraph">열거 형식의 범위는 언어 컨텍스트 및 지정된 컴파일러 플래그에 따라 달라집니다. </p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-format="autorelaxed"
     data-ad-client="ca-pub-5698326622209671"
     data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/cpp-data-type-range/3766/">C++ 데이터 형식 범위 (&lt;strong&gt;Microsoft Visual C++&lt;/strong&gt;)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/cpp-data-type-range/3766/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
