프로그래밍을 배우기 전에 핵심 용어부터 정리합시다.
가공되지 않은 날것의 사실입니다. 숫자, 문자, 이미지 등 컴퓨터가 처리할 수 있는 모든 것을 말합니다.
예: "25", "서울", "37.5도", "비"
데이터를 가공·처리하여 의미를 부여한 것입니다.
예: "오늘 서울 기온 25도, 오후에 비가 올 예정"
정보를 기반으로 판단·예측할 수 있는 능력입니다.
예: "비가 오니까 우산을 가져가야겠다"
Let's clarify core terminology before learning programming.
Raw, unprocessed facts. Numbers, text, images — anything a computer can handle.
e.g., "25", "Seoul", "37.5°C", "rain"
Data that has been processed and given meaning.
e.g., "Today's Seoul temp is 25°C, rain expected in the afternoon"
The ability to make judgments and predictions based on information.
e.g., "It's going to rain, so I should bring an umbrella"

정리되지 않은 그릇(왼쪽) vs 체계적으로 정리된 그릇(오른쪽)
자료구조(Data Structure)란 데이터를 효율적으로 저장하고 관리하기 위한 구조입니다. 같은 데이터라도 어떤 그릇에 담느냐에 따라 꺼내 쓰는 속도가 달라집니다.
양말, 속옷, 티셔츠를 한 서랍에 다 넣으면? → 찾기 어렵습니다. 종류별로 칸을 나누면? → 바로 찾을 수 있습니다!
서랍장 = 자료구조, 옷 = 데이터, 칸 나누기 = 구조화
책 1만 권을 바닥에 쌓아두면? → 특정 책을 찾는 데 몇 시간이 걸립니다. 분류번호(DDC)로 정리하면? → 1분 안에 찾습니다!
도서관 분류 시스템 = 자료구조
자료구조를 잘 선택하면 프로그램의 속도와 메모리 효율이 크게 달라집니다. 이 수업에서 다양한 자료구조를 배우고, 각각 언제 사용하면 좋은지 판단하는 능력을 키울 것입니다.

Unorganized dishes (left) vs systematically organized (right)
A Data Structure is a way to store and manage data efficiently. Even with the same data, how fast you can access it depends on the container you choose.
Throw all socks, underwear, and t-shirts in one drawer? → Hard to find anything. Separate by category? → Instant access!
Dresser = Data Structure, Clothes = Data, Organizing = Structuring
Pile 10,000 books on the floor? → Takes hours to find one. Organize by classification (DDC)? → Found in under a minute!
Library classification = Data Structure
Choosing the right data structure dramatically affects a program's speed and memory efficiency. In this course, you'll learn various data structures and develop the ability to judge when to use each.

그림 1-1. (a) 자료구조가 없는 동물원 vs (b) 자료구조가 있는 동물원
동물원에 7종의 동물이 있습니다. 관리 방법에 따라 효율이 달라집니다.
7마리를 하나의 큰 우리에 넣음 → 특정 동물 찾기 어려움, 동물끼리 싸움, 관리 비효율
종류별로 분리하여 관리 → 빠르게 찾기 가능, 안전하고 효율적
좋은 자료구조를 선택하면 알고리즘이 간단해지고, 프로그램 성능도 향상됩니다. 이것이 우리가 자료구조를 배우는 이유입니다!

Fig 1-1. (a) Zoo without data structure vs (b) Zoo with data structure
A zoo has 7 kinds of animals. Efficiency depends on how you manage them.
Put all 7 in one big enclosure → Hard to find, animals fight, inefficient
Separate by type → Quick access, safe, efficient
Choosing a good data structure simplifies algorithms and improves performance. That's why we study data structures!
그림 1-2. 자료구조의 종류 (교재 원본)
프로그래밍 언어가 기본 제공하는 데이터 타입입니다. 정수(int), 실수(float), 문자(char), 문자열(string)이 있습니다. 예를 들어 나이 = 20(정수), 키 = 175.5(실수) 등이 있습니다.
데이터가 일렬로 나열된 구조. 앞뒤 관계가 1:1입니다.
하나의 데이터가 여러 개와 연결되는 구조. 1:N 관계입니다.
Fig 1-2. Types of Data Structures (English version)
Built-in data types of a programming language: integer (int), float, character (char), string. For example: age = 20 (int), height = 175.5 (float).
Data arranged in a line. Each element has a 1:1 predecessor/successor.
One element connects to multiple others. 1:N relationships.

그림 1-3. 선형 자료구조의 형태
데이터를 순서대로 나열한 자료구조입니다. 영어 단어 뜻 그대로 "목록"입니다.
마트 쇼핑 목록을 생각하세요: 우유, 빵, 달걀, 치즈 순서대로 적습니다. 중간에 "버터"를 추가하거나, "달걀"을 지울 수도 있습니다.
데이터가 메모리에 연속적으로 저장됩니다. 각 데이터는 번호(인덱스)가 있어 바로 접근 가능합니다.
데이터가 메모리 여기저기에 흩어져 있지만, 화살표(포인터)로 연결됩니다.
장점: 중간 삽입/삭제가 쉬움 → 화살표만 바꾸면 됨!

Fig 1-3. Form of Linear Data Structures
A data structure that arranges data in order. It literally means a "list" or "catalog."
Think of a shopping list: milk, bread, eggs, cheese — written in order. You can add "butter" in between or remove "eggs."
Data stored contiguously in memory. Each item has an index number for direct access.
Data is scattered in memory, but connected by arrows (pointers).
Advantage: Easy insertion/deletion → just change the pointers!
영어로 "쌓다"라는 뜻입니다. 접시를 쌓아올리듯 나중에 넣은 것이 먼저 나오는 구조입니다.
영어로 "줄을 서다"라는 뜻입니다. 먼저 넣은 것이 먼저 나오는 구조입니다.
Means "to stack." Like stacking plates — the last item in comes out first.
Means "to line up." The first item in comes out first.

그림 1-4. 비선형 자료구조의 형태 (트리)
나무를 거꾸로 뒤집은 모양입니다. 하나의 뿌리(root)에서 시작해 가지를 치며 뻗어 나갑니다. 부모-자식 관계가 있는 계층 구조입니다.
점(정점, Vertex)들이 선(간선, Edge)으로 자유롭게 연결된 구조입니다. 트리와 달리 순환(사이클)이 가능합니다.

Fig 1-4. Form of Non-linear Data Structures (Tree)
Shaped like an upside-down tree. It starts from a root and branches out. It's a hierarchical structure with parent-child relationships.
Points (vertices) freely connected by lines (edges). Unlike trees, cycles are possible.
데이터를 처리 순서대로 연속 저장합니다. 공간 효율이 높지만, 중간 삽입/삭제 시 전체를 재구성해야 합니다.
그림 1-5. 순차 파일에서 중간에 데이터 삽입
비유: 카세트 테이프 — 처음부터 순서대로 재생해야 함
해시 함수를 사용하여 데이터의 저장 위치를 계산합니다. 바로 원하는 위치에 접근할 수 있어 검색이 매우 빠릅니다.
그림 1-6. 해시 함수를 이용한 직접 파일
순차 파일과 직접 파일의 장점을 결합한 구조입니다. 색인(목차)을 통해 빠르게 위치를 찾고, 그 위치부터 순차적으로 읽습니다.
비유: 사전 — 색인(ㄱ,ㄴ,ㄷ...)으로 빠르게 찾음
Data stored continuously in processing order. Space-efficient, but inserting/deleting requires restructuring everything.
Fig 1-5. Inserting data into a Sequential File
Uses a hash function to calculate storage locations. Enables instant access to any position, making searches very fast.
Fig 1-6. Direct File using Hash Function
Combines advantages of sequential and direct files. Uses an index (table of contents) for quick lookup, then reads sequentially from that point.
Analogy: Dictionary — quickly find entries via the index
해시 함수: 데이터(Key) → 해시값(Index)
해시(Hash)란 데이터를 입력받아 고정된 크기의 값으로 변환하는 것입니다. 이 변환 규칙을 해시 함수라고 합니다.
학번 20250101인 학생에게 사물함을 배정할 때:
해시 함수: 학번 ÷ 100의 나머지 = 사물함 번호
20250101 ÷ 100 = 나머지 1 → 1번 사물함!
20250237 ÷ 100 = 나머지 37 → 37번 사물함!
Hash Function: Data (Key) → Hash Value (Index)
Hashing takes input data and converts it to a fixed-size value. The conversion rule is called a hash function.
Assigning a locker to student ID 20250101:
Hash function: Student ID mod 100 = Locker number
20250101 mod 100 = remainder 1 → Locker #1!
20250237 mod 100 = remainder 37 → Locker #37!
| 자료구조 | 특징 | 생활 비유 | 배울 장 |
|---|---|---|---|
| 리스트 | 순서대로 나열, 인덱스 접근 | 쇼핑 목록 | 3장 |
| 연결 리스트 | 포인터로 연결, 삽입/삭제 유연 | 기차 칸 연결 | 3장 |
| 스택 | LIFO (후입선출) | 접시 쌓기 | 4장 |
| 큐 | FIFO (선입선출) | 매표소 줄 | 5장 |
| 트리 | 계층 구조, 부모-자식 | 조직도 | 7장 |
| 그래프 | 자유로운 연결, 사이클 가능 | 지하철 노선도 | 8장 |
| Structure | Key Feature | Analogy | Chapter |
|---|---|---|---|
| List | Ordered, index access | Shopping list | Ch. 3 |
| Linked List | Pointer-linked, flexible insert/delete | Train cars | Ch. 3 |
| Stack | LIFO (Last In, First Out) | Stacking plates | Ch. 4 |
| Queue | FIFO (First In, First Out) | Ticket line | Ch. 5 |
| Tree | Hierarchical, parent-child | Org chart | Ch. 7 |
| Graph | Free connections, cycles possible | Subway map | Ch. 8 |
다음 자료구조를 선형과 비선형으로 분류하세요:
스택, 그래프, 큐, 트리, 연결 리스트, 선형 리스트
| 선형 자료구조 | 비선형 자료구조 |
|---|---|
다음 상황에 어울리는 자료구조를 선택하고 이유를 말해 보세요:
Classify into Linear and Non-linear:
Stack, Graph, Queue, Tree, Linked List, Linear List
| Linear | Non-linear |
|---|---|
Choose a matching data structure and explain why:
어떤 문제를 해결하기 위한 단계적인 절차입니다. 정해진 입력을 받아서 원하는 출력을 만들어 내는 일련의 과정을 말합니다.
라면 끓이기 알고리즘:
① 물 550ml를 냄비에 넣는다 → ② 물이 끓으면 면과 스프를 넣는다 → ③ 4분 30초 기다린다 → ④ 불을 끈다 → ⑤ 완성!
ATM에서 돈 찾기 알고리즘:
① 카드 삽입 → ② 비밀번호 입력 → ③ 출금 금액 입력 → ④ 잔액 확인 → ⑤ (잔액 충분하면) 돈 출금 → ⑥ 카드 반환
A step-by-step procedure for solving a problem. A series of operations that takes given inputs and produces desired outputs.
Cooking ramen algorithm:
① Add 550ml water to pot → ② When boiling, add noodles and seasoning → ③ Wait 4 min 30 sec → ④ Turn off heat → ⑤ Done!
ATM withdrawal algorithm:
① Insert card → ② Enter PIN → ③ Enter amount → ④ Check balance → ⑤ (If sufficient) Dispense cash → ⑥ Return card

그림 1-7. 동물원으로 동물 이동시키기 (최대 7톤)
동물원에 7종의 동물이 있습니다. 이 동물들을 다른 동물원으로 옮기려고 합니다. 트럭은 최대 7톤까지 실을 수 있고, 단 1회만 운송할 수 있습니다.
| 동물 | 무게(톤) | 선호도 |
|---|---|---|
| 호랑이 | 2.5 | 10 |
| 사자 | 3.0 | 8 |
| 하마 | 3.5 | 5 |
| 원숭이 | 0.5 | 3 |
| 코끼리 | 5.0 | 9 |
| 기린 | 1.5 | 6 |
| 판다 | 1.0 | 7 |
무게 합이 7톤 이하이면서, 선호도 합이 최대가 되도록 동물을 선택하세요!

Fig 1-7. Moving animals to the zoo (max 7 tons)
A zoo has 7 animals that need to be transported. The truck can carry max 7 tons in only 1 trip.
| Animal | Weight(t) | Preference |
|---|---|---|
| Tiger | 2.5 | 10 |
| Lion | 3.0 | 8 |
| Hippo | 3.5 | 5 |
| Monkey | 0.5 | 3 |
| Elephant | 5.0 | 9 |
| Giraffe | 1.5 | 6 |
| Panda | 1.0 | 7 |
Select animals where total weight ≤ 7 tons and total preference is maximized!
7마리 중 가능한 모든 조합을 확인합니다. 총 경우의 수 = 2⁷ = 128가지
각 동물마다 "태우다 / 안 태우다" 2가지 선택이 있으므로, 2 × 2 × 2 × 2 × 2 × 2 × 2 = 2⁷ = 128가지입니다.
그리디 알고리즘으로 동물 선택 과정 (교재 풀이)
"무게 대비 선호도"가 높은 순서로 골라봅시다.
Check every possible combination of 7 animals. Total cases = 2⁷ = 128
Each animal has 2 choices: "load / don't load." So 2 × 2 × 2 × 2 × 2 × 2 × 2 = 2⁷ = 128 combinations.
Greedy algorithm selection process (textbook approach)
Pick by highest "preference-to-weight ratio" first.
동물 7마리 중에서 몇 마리를 고르는 경우의 수를 수학적으로 계산해 봅시다.
공식: nCr = n! / ((n-r)! × r!)
"호랑이-하마"와 "하마-호랑이"를 같은 것으로 취급
| 선택 수 | 계산 | 경우의 수 |
|---|---|---|
| 0마리 | 7C0 | 1 |
| 1마리 | 7C1 | 7 |
| 2마리 | 7C2 | 21 |
| 3마리 | 7C3 | 35 |
| 4마리 | 7C4 | 35 |
| 5마리 | 7C5 | 21 |
| 6마리 | 7C6 | 7 |
| 7마리 | 7C7 | 1 |
총합 = 128가지 (= 2⁷, 각 동물이 2가지 선택지를 가지므로)
공식: nPr = n! / (n-r)!
"호랑이-하마"와 "하마-호랑이"를 다른 것으로 취급
예: 7P2 = 7 × 6 = 42가지
Let's mathematically calculate how many ways we can choose from 7 animals.
Formula: nCr = n! / ((n-r)! × r!)
"Tiger-Hippo" and "Hippo-Tiger" are the same
| Chosen | Formula | Count |
|---|---|---|
| 0 | 7C0 | 1 |
| 1 | 7C1 | 7 |
| 2 | 7C2 | 21 |
| 3 | 7C3 | 35 |
| 4 | 7C4 | 35 |
| 5 | 7C5 | 21 |
| 6 | 7C6 | 7 |
| 7 | 7C7 | 1 |
Total = 128 (= 2⁷, each animal has 2 choices)
Formula: nPr = n! / (n-r)!
"Tiger-Hippo" and "Hippo-Tiger" are different
e.g., 7P2 = 7 × 6 = 42 ways

그림 1-8. 일반 언어(자연어) 표현 예시
사람이 쓰는 말과 글로 알고리즘을 설명하는 방법입니다.
① 두 수 A와 B를 입력받는다.
② A가 B보다 크면, A를 출력한다.
③ 그렇지 않으면, B를 출력한다.
장점: 이해하기 쉬움 / 단점: 모호할 수 있음, 코드 변환 어려움
그림 1-9. 동물 트럭 문제의 순서도 표현
도형과 화살표로 알고리즘을 시각적으로 표현합니다.
| 도형 | 의미 | 설명 |
|---|---|---|
| ⬭ | 시작/종료 | 둥근 사각형 |
| ▭ | 처리/연산 | 직사각형 |
| ◇ | 판단/조건 | 마름모 |
| ▱ | 입출력 | 평행사변형 |
| → | 흐름선 | 화살표 |
Describing an algorithm using everyday words.
① Read two numbers A and B.
② If A is greater than B, output A.
③ Otherwise, output B.
Pro: Easy to understand / Con: Can be ambiguous, hard to code
Fig 1-9. Flowchart for zoo truck problem
Visual representation using shapes and arrows.
| Shape | Meaning | Description |
|---|---|---|
| ⬭ | Start/End | Rounded rectangle |
| ▭ | Process | Rectangle |
| ◇ | Decision | Diamond |
| ▱ | Input/Output | Parallelogram |
| → | Flow line | Arrow |

그림 1-10. 의사코드 표현 예 (교재)
프로그래밍 언어와 자연어를 섞어서 알고리즘을 표현하는 방법입니다. "가짜 코드"라는 뜻으로, 실제로 실행되지는 않지만 프로그램 구조를 명확히 보여줍니다.
장점: 코드 변환이 쉬움 / 단점: 비전공자가 읽기 어려울 수 있음

그림 1-11. 프로그램 코드(파이썬)로 표현
실제 프로그래밍 언어로 작성하여 컴퓨터가 실행할 수 있는 형태입니다.
자연어 → 순서도 → 의사코드 → 프로그램 코드 순서로 점점 컴퓨터에 가까워집니다. 이 수업에서는 주로 의사코드와 파이썬 코드를 사용합니다.

Fig 1-10. Pseudocode representation (textbook)
A mix of programming language and natural language. "Pseudo" means "fake" — it doesn't run, but clearly shows program structure.
Pro: Easy to convert to code / Con: Non-programmers may find it harder

Fig 1-11. Expression in program code (Python)
Written in an actual programming language — executable by a computer.
Natural Language → Flowchart → Pseudocode → Program Code — each step gets closer to the computer. In this course, we mainly use pseudocode and Python.
그림 1-12, 1-13. 1~100 합을 구하는 두 알고리즘 비교
같은 문제를 푸는 알고리즘이 여러 개라면, 어떤 것이 더 좋은지 비교해야 합니다. 실행 시간을 기준으로 비교하는 것을 시간 복잡도라고 합니다.
방법 1: 처음부터 한 명씩 확인 → 최악 100번 확인 → O(n)
방법 2: 이름순 정렬 후 반씩 나누어 찾기 → 최악 7번 확인 → O(log n)
방법 2가 훨씬 빠릅니다! (100명 → 50명 → 25명 → ... → 1명)
실행 시간은 컴퓨터 성능에 따라 달라지므로, 실제 시간(초) 대신 연산 횟수로 성능을 측정합니다. 데이터 개수 n에 따라 연산 횟수가 어떻게 변하는지를 표현합니다.
데이터가 늘면 시간도 비례해서 증가
→ O(n)
데이터가 늘어도 시간 동일
→ O(1)
Fig 1-12, 1-13. Two algorithms for summing 1 to 100
Fig 1-14. Comparison of two algorithms' operation time
When multiple algorithms solve the same problem, we need to compare them. Comparing by execution time is called time complexity.
Method 1: Check one by one from start → Worst case 100 checks → O(n)
Method 2: Sort by name, then halve repeatedly → Worst case 7 checks → O(log n)
Method 2 is much faster! (100 → 50 → 25 → ... → 1)
Execution time varies with hardware, so we measure operation count instead of seconds. We express how the operation count changes as data size n grows.
Time grows proportionally with data
→ O(n)
Time stays constant regardless of data
→ O(1)
그림 1-15. 시간 복잡도 함수의 그래프
최악의 경우를 기준으로 알고리즘 성능을 표기하는 방법입니다. "아무리 느려도 이 정도는 된다"를 보장합니다.
| 표기 | 이름 | n=10 | n=100 | 속도 |
|---|---|---|---|---|
| O(1) | 상수 | 1 | 1 | 최고 |
| O(log n) | 로그 | 3.3 | 6.6 | 빠름 |
| O(n) | 선형 | 10 | 100 | 보통 |
| O(n log n) | 선형로그 | 33 | 664 | 보통 |
| O(n²) | 이차 | 100 | 10,000 | 느림 |
| O(2ⁿ) | 지수 | 1,024 | 1.27×10³⁰ | 최악 |
Fig 1-15. Time Complexity Function Graphs
A way to express algorithm performance based on the worst case. It guarantees "it will be at least this fast."
| Notation | Name | n=10 | n=100 | Speed |
|---|---|---|---|---|
| O(1) | Constant | 1 | 1 | Best |
| O(log n) | Logarithmic | 3.3 | 6.6 | Fast |
| O(n) | Linear | 10 | 100 | Moderate |
| O(n log n) | Linearithmic | 33 | 664 | Moderate |
| O(n²) | Quadratic | 100 | 10,000 | Slow |
| O(2ⁿ) | Exponential | 1,024 | 1.27×10³⁰ | Worst |
O(3n) → O(n), O(5n²) → O(n²)
이유: n이 매우 클 때 상수는 의미가 없어짐
O(n² + n) → O(n²), O(n³ + n² + n) → O(n³)
이유: n이 커지면 가장 큰 항이 지배적
데이터가 5개든 100만 개든 항상 1번만 실행 → O(1)
데이터 5개면 5번, 100개면 100번 → 데이터에 비례 → O(n)
O(3n) → O(n), O(5n²) → O(n²)
Why: When n is very large, constants become insignificant
O(n² + n) → O(n²), O(n³ + n² + n) → O(n³)
Why: The largest term dominates as n grows
Whether 5 or 1,000,000 items, always runs once → O(1)
5 items = 5 times, 100 items = 100 times → proportional → O(n)
데이터 5개 → 25번, 100개 → 10,000번 실행! → O(n²)
1000이면? → 약 10번만에 끝남 → O(log n)
| 코드 패턴 | 시간 복잡도 |
|---|---|
| 반복 없음 (단순 연산) | O(1) |
| 반으로 나누며 탐색 | O(log n) |
| for문 1개 (1~n) | O(n) |
| for문 중첩 2개 | O(n²) |
| for문 중첩 3개 | O(n³) |
5 items → 25 times, 100 items → 10,000 times! → O(n²)
1000? → Only about 10 steps → O(log n)
| Code Pattern | Time Complexity |
|---|---|
| No loops (simple operation) | O(1) |
| Halving search | O(log n) |
| Single for loop (1~n) | O(n) |
| Nested 2 loops | O(n²) |
| Nested 3 loops | O(n³) |
동물원에 7종의 동물이 있습니다. 태우는 순서가 없다고 가정하면, 동물 2마리를 선택하는 경우의 수는?
힌트: 조합 공식 nCr = n! / ((n-r)! × r!)
다음 빅-오 표기를 빠른 순서로 정렬하세요:
O(n²), O(1), O(n), O(log n), O(2ⁿ), O(n log n)
정답: ______ → ______ → ______ → ______ → ______ → ______
다음 코드의 시간 복잡도를 구하세요:
답: O( ____ )
답: O( ____ )
데이터 개수(n)가 15일 때, 다음을 계산하세요:
A zoo has 7 animals. Assuming order doesn't matter, how many ways can you choose 2?
Hint: nCr = n! / ((n-r)! × r!)
Sort from fastest to slowest:
O(n²), O(1), O(n), O(log n), O(2ⁿ), O(n log n)
Answer: ______ → ______ → ______ → ______ → ______ → ______
Find the time complexity of each code:
Answer: O( ____ )
Answer: O( ____ )
When n = 15, calculate:
사람은 한국어, 영어 등의 언어로 소통합니다. 마찬가지로 컴퓨터에게 명령을 내리려면 컴퓨터가 이해할 수 있는 언어가 필요합니다. 이것이 바로 프로그래밍 언어입니다.
영어를 모르는 한국인이 영어만 하는 외국인에게 길을 알려주려면? → 통역사(번역기)가 필요합니다!
프로그래밍 언어 = 사람의 생각을 컴퓨터 언어(0과 1)로 번역해주는 도구
전체를 한 번에 번역 후 실행
비유: 책 전체를 번역 후 읽기
예: C, C++, Java
한 줄씩 번역하면서 실행
비유: 동시통역처럼 한 문장씩
예: Python, JavaScript
그림 1-16. 자료구조 + 알고리즘 + 프로그래밍 언어 = 소프트웨어
파이썬은 인터프리터 방식이므로, 코드를 한 줄 입력하면 바로 결과를 확인할 수 있습니다. 이것이 초보자에게 유리한 이유입니다!
People communicate using Korean, English, etc. Similarly, to give commands to a computer, we need a language the computer understands. That's a programming language.
A Korean who doesn't speak English wants to help an English-only speaker → needs a translator!
Programming language = a tool that translates human ideas into computer language (0s and 1s)
Translates everything at once, then runs
Analogy: Translate entire book, then read
e.g., C, C++, Java
Translates and runs line by line
Analogy: Simultaneous translation
e.g., Python, JavaScript
Fig 1-16. Data Structure + Algorithm + Language = Software
Python is an interpreter language, so you can see results immediately after typing each line. That's why it's great for beginners!

Python: 배우기 쉽고 강력한 프로그래밍 언어
귀도 반 로섬(Guido van Rossum)이 C 언어로 만들어 1991년에 공식 발표한 프로그래밍 언어입니다.
이름의 유래: 영국 코미디 프로그램 "몬티 파이썬(Monty Python)"에서 따옴
영어와 비슷한 직관적인 문법. 다른 언어에 비해 코드가 매우 짧습니다.
코드를 한 줄씩 실행하여 바로 결과를 확인할 수 있습니다. 실험하며 배우기에 최적입니다.
이미 만들어진 수천 개의 도구를 바로 가져다 쓸 수 있습니다. (NumPy, Pandas, TensorFlow 등)
누구나 무료로 사용할 수 있고, 전 세계 개발자가 함께 개선합니다.
AI, 웹 개발, 데이터 분석, 자동화, 게임 등 거의 모든 분야에서 사용됩니다.

Python: Easy to learn, powerful programming language
Created by Guido van Rossum in C and officially released in 1991.
Named after the British comedy show "Monty Python"
Intuitive grammar similar to English. Much shorter code than other languages.
Executes code line by line with instant results. Perfect for learning by experimenting.
Thousands of ready-to-use tools available. (NumPy, Pandas, TensorFlow, etc.)
Free for everyone, improved by developers worldwide.
AI, web dev, data analysis, automation, games — used in nearly every field.
ChatGPT, 이미지 인식, 음성 인식 등 AI 기술 개발에 가장 많이 사용됩니다. TensorFlow, PyTorch 등의 라이브러리를 활용합니다.
대량의 데이터를 분석하고 그래프로 표현합니다. 기업에서 매출 분석, 트렌드 예측 등에 활용합니다.
Django, Flask 등의 프레임워크로 웹사이트를 만듭니다. Instagram도 파이썬(Django)으로 개발되었습니다!
반복적인 엑셀 작업, 파일 정리, 이메일 발송 등을 자동화합니다. 업무 시간을 크게 절약할 수 있습니다.
Pygame으로 간단한 게임을 만들 수 있고, 프로그래밍 교육용으로 전 세계 대학에서 사용됩니다.
우리는 파이썬을 사용하여 자료구조와 알고리즘을 직접 구현하고 테스트합니다. 파이썬의 쉬운 문법 덕분에 알고리즘 자체에 집중할 수 있습니다.
Most popular language for AI: ChatGPT, image recognition, speech recognition. Uses TensorFlow, PyTorch, etc.
Analyze large datasets and create graphs. Used in businesses for sales analysis, trend prediction, etc.
Build websites with Django, Flask frameworks. Instagram was built with Python (Django)!
Automate repetitive Excel work, file organization, email sending. Saves significant work time.
Create simple games with Pygame. Used for programming education at universities worldwide.
We'll use Python to implement and test data structures and algorithms. Python's easy syntax lets us focus on the algorithms themselves.

그림 1-18. python.org 웹사이트에서 다운로드
설치 화면 하단의 "Add Python to PATH"에 반드시 체크하세요!
체크하지 않으면 명령 프롬프트에서 Python을 실행할 수 없습니다. 체크 후 [Install Now]를 클릭합니다.

그림 1-19. 파이썬 설치 화면 (Add to PATH 체크 필수!)
시작 메뉴에서 "IDLE"을 검색하여 실행하면 파이썬 대화형 창이 열립니다.
Check "Add Python to PATH" at the bottom of the install screen!
Without it, you can't run Python from the command prompt. After checking, click [Install Now].

Fig 1-19. Python installation screen (must check Add to PATH!)
Search for "IDLE" in the Start menu and open it — the Python interactive shell will appear.
IDLE(Integrated Development and Learning Environment)은 파이썬과 함께 설치되는 기본 개발 도구입니다. 코드를 입력하고 바로 실행 결과를 볼 수 있습니다.
>>> 기호 뒤에 코드를 한 줄씩 입력하면 바로 결과가 나옵니다. 계산기처럼 사용할 수 있습니다!

그림 1-20. IDLE 시작 화면 (대화형 모드)

그림 1-21. IDLE에서 코드 입력 및 실행
장점: 코드를 바로 테스트 가능, 학습에 유용
단점: 코드가 저장되지 않음, 긴 프로그램에 부적합
IDLE (Integrated Development and Learning Environment) is a basic development tool installed with Python. Write code and see results immediately.
Type code after the >>> prompt — results appear instantly. Use it like a calculator!

Fig 1-20. IDLE start screen (Interactive Mode)

Fig 1-21. Typing code and seeing results in IDLE
Pro: Test code instantly, great for learning
Con: Code isn't saved, not ideal for long programs
여러 줄의 코드를 파일로 저장하고 한 번에 실행하는 방식입니다. 실제 프로그램을 만들 때 사용합니다.

그림 1-22. IDLE 스크립트 모드 — 코드 작성 및 실행
Save multiple lines of code as a file and run them all at once. Used for real programs.

Fig 1-22. IDLE Script Mode — writing and running code
변수란 데이터를 저장하는 상자입니다. 이름을 붙여서 나중에 꺼내 쓸 수 있습니다.

그림 1-23. 파이썬 파일 저장 화면

그림 1-24. 파이썬 파일 실행 결과
A variable is a box for storing data. Give it a name to use later.

Fig 1-23. Saving a Python file

Fig 1-24. Running a Python file and output
input() 함수를 사용하면 키보드로 값을 입력받을 수 있습니다.
input()은 항상 문자열을 반환합니다. 숫자로 사용하려면 int()나 float()로 변환해야 합니다!
조건에 따라 다른 코드를 실행합니다.
Use input() to read keyboard input.
input() always returns a string. To use as a number, convert with int() or float()!
Execute different code based on conditions.
정해진 횟수만큼 반복합니다. range(n)은 0부터 n-1까지의 숫자를 만들어줍니다.
조건이 참인 동안 계속 반복합니다.
배열 탐색, 정렬, 탐색 알고리즘 등 거의 모든 알고리즘에서 반복문을 사용합니다. 시간 복잡도도 반복문의 횟수로 결정됩니다!
Repeats a fixed number of times. range(n) creates numbers from 0 to n-1.
Repeats as long as a condition is true.
Array traversal, sorting, search algorithms — nearly every algorithm uses loops. Time complexity is determined by loop iterations!
| 주차 | 내용 | 핵심 |
|---|---|---|
| 1주 | 자료구조와 알고리즘 소개 | 개념 이해 |
| 2주 | 파이썬 기초 | 코딩 기본 |
| 3-4주 | 리스트, 연결 리스트 | 선형 구조 |
| 5-6주 | 스택, 큐 | LIFO/FIFO |
| 7주 | 중간고사 | - |
| 8-10주 | 트리, 그래프 | 비선형 구조 |
| 11-13주 | 정렬, 탐색 | 알고리즘 |
| 14주 | 기말고사 | - |
① 수업을 듣고 → ② 직접 코드를 작성하고 → ③ 실행해 보는 3단계를 반복하세요. 이해 안 되는 건 반드시 질문하세요!
| Week | Topic | Focus |
|---|---|---|
| 1 | Intro to DS & Algorithms | Concepts |
| 2 | Python Basics | Coding fundamentals |
| 3-4 | List, Linked List | Linear structures |
| 5-6 | Stack, Queue | LIFO/FIFO |
| 7 | Midterm Exam | - |
| 8-10 | Tree, Graph | Non-linear |
| 11-13 | Sorting, Searching | Algorithms |
| 14 | Final Exam | - |
① Attend class → ② Write code yourself → ③ Run and test it. Repeat these 3 steps. Always ask questions when you're stuck!
파이썬 IDLE을 실행하고 다음 코드를 입력하여 정상 동작하는지 확인하세요:
새 파일을 만들고 아래 코드를 입력한 후 Self01-03.py로 저장하고 실행하세요:
print() 함수를 사용하여 자기소개 프로그램을 작성하세요. 최소 5줄 이상으로 이름, 학과, 취미, 목표 등을 출력하세요.
두 수를 입력받아 사칙연산 결과를 모두 출력하는 프로그램을 작성하세요:
Open Python IDLE and type the following to confirm it works:
Create a new file, type the code below, save as Self01-03.py, and run:
Write a self-introduction program using print(). At least 5 lines with name, major, hobbies, goals, etc.
Write a program that reads two numbers and prints all four arithmetic results: