Introduction to Algorithm and
C++
Algoritma dan Pemrograman
TEL624103
What is an Algorithm
DEFINITION: A STEP-BY-STEP EXAMPLE: MAKING A CUP OF TEA. CHARACTERISTICS: FINITE,
PROCEDURE TO SOLVE A PROBLEM. UNAMBIGUOUS, EFFECTIVE.
Why Do We Need Algorithms?
Problem-solving Efficiency Foundation of
programming
Representations of Algorithms
NATURAL LANGUAGE PSEUDOCODE FLOWCHART (VISUAL
(INFORMAL) (STRUCTURED TEXT) DIAGRAM)
Flowcharts
Flowchart
s example
Psudo Code
Definition:
Not bound to any
Informal, high-
programming
level description
language
of algorithm
Start
Boil water
Put tea bag in cup
Pour hot water into cup
Steep for 3–5 minutes
Pseudo Remove tea bag
If sugar or milk is desired then
code EndIf
Add sugar/milk
example Stir the tea
Serve and enjoy
End
Flowchart vs Pseudocode
Flowchart: Visual, easy to Pseudocode: Easier to
understand, good for implement in code,
beginners concise
Task 1
Create a flowchart and pseudo code for some activity
What is a Programming Language?
A set of
Used to solve
instructions used Two major
problems and
to communicate categories:
automate tasks.
with a computer.
High-level (human-
Low-level (close to
friendly, like
machine code)
Python, C++, Java)
Types of Programming Languages
Compiled • Source code → Compiler → Machine code
• Fast execution
Languages • Example: C, C++, Go, Rust
Interpreted • Source code → Interpreter → Execution line by line
• Easier to test/debug
Languages • Example: Python, JavaScript, Ruby
Types of Programming
Languages
Feature Compiled Languages Interpreted Languages
Execution Speed Fast (machine code) Slower (line-by-line)
Portability Needs recompilation Runs anywhere
interpreter exists
Example Languages C, C++, Java (JIT) Python, PHP, JavaScript
Examples of Popular Languages
• C/C++ → System software, high-performance apps
• Java → Enterprise, Android apps
• Python → Data science, AI, scripting
• JavaScript → Web development
• PHP → Web backend
• Go / Rust → Modern systems programming
What is C++
General-purpose Extension of C with object-
programming language oriented features.
developed by Bjarne
Stroustrup.
Object-oriented programming (OOP)
Fast execution & efficiency
Features of Rich library support (STL)
C++
Platform independent
Can do both low-level (system) and high-level
programming
Features of C++
#include <iostream>
using namespace std; • #include <iostream> → header file for
input/output
int main() {
cout << "Hello, World!"; • main() → starting point of every C++ program
return 0;
} • cout → output statement
Task 2
Install C++ on your laptop/smartphone
VS code and c++ installation on laptop tutorial