Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

FlowGorithm Demo Class

Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

มหาวิทยาลัยราชภัฏสวนสุนันทา DTC2301

Suan Sunandha Rajabhat University Control Robotic Programing for Education

FlowGorithm
DTC2301 Control Robotic Programing
for Education

Asst.Prof.Dr.Nutthapat Kaewrattanapat
Digital Technology for Education
https://elsci.ssru.ac.th/nutthapat_ke
nutthapat.ke@ssru.ac.th Faculty of Education, SSRU
Computational Thinking
• Definition: Computational thinking is a problem-solving
approach that draws on principles from computer science to
address complex issues in a structured and logical way.

Problem
Problem
Solving

DTC2301 Control Robotic Programing for Education


Computational Thinking
Key Concepts:
• Decomposition: Breaking down
complex problems into smaller,
manageable parts or subproblems.
• Pattern Recognition: Identifying
common patterns or similarities within
data or problems.
• Abstraction: Focusing on the essential
details while ignoring unnecessary
information.
• Algorithmic Thinking: Developing step-
by-step solutions or algorithms to solve
problems.

DTC2301 Control Robotic Programing for Education


Agenda
1. Understanding Programming Fundamentals
2. What Are Algorithms?
3. Types of Algorithms
4. Introduction to Programming Languages
5. Building Your First Program
6. Resources and Next Steps

DTC2301 Control Robotic Programing for Education


1. Understanding Programming Fundamentals

• What is Programming?
• Why Learn Programming?
• Key Concepts:
• Variables
• Control Structures (e.g., loops, conditionals)
• Functions
• Data Types

DTC2301 Control Robotic Programing for Education


2. What Are Algorithms?

• Definition: An algorithm is a step-by-step set of instructions for


solving a specific problem or task.
• Importance of Algorithms:
• They are the building blocks of all computer programs.
• Efficient algorithms are crucial for optimizing program performance.
• Examples:
• Sorting algorithms (e.g., Bubble Sort, Quick Sort)
• Searching algorithms (e.g., Linear Search, Binary Search)

DTC2301 Control Robotic Programing for Education


3. Types of Algorithms

1. Sequential Algorithms:
• Follow a linear sequence of steps.
• Examples: Calculating the sum of numbers, printing elements of an array.
2. Decision-based Algorithms:
• Make choices based on conditions.
• Examples: If statements, switch statements.
3. Iterative Algorithms:
• Repeat a set of instructions until a condition is met.
• Examples: While loops, for loops.
4. Recursive Algorithms:
• Solve a problem by breaking it down into smaller instances of the same problem.
• Examples: Fibonacci sequence calculation, recursive functions.

DTC2301 Control Robotic Programing for Education


4. Introduction to Programming Languages

What is a Programming Language?


• Definition: A programming language is a formalized way of
instructing a computer to perform specific tasks.
• Popular Programming Languages:
• Python
• Java
• C++
• JavaScript
• Ruby
DTC2301 Control Robotic Programing for Education
4. Introduction to Programming Languages

Choosing the Right Language, Factors to Consider:


• Purpose of the program
• Ease of learning
• Community and resources
• Job market demand

DTC2301 Control Robotic Programing for Education


5. Building Your First Program

• Setting Up Your Development Environment


• Choose a code editor (e.g., Visual Studio Code, PyCharm).
• Install the necessary programming language (e.g., Python).
• Writing Your First Code
• Simple "Hello, World!" program as an example.
• Compiling or Running the Code
• Explain how to execute the program and see the output.
• Debugging and Troubleshooting
• Mention the importance of debugging tools and resources.
DTC2301 Control Robotic Programing for Education
6. Resources and Next Steps

• Learning Resources:
• Online tutorials and courses (e.g., Codecademy, Coursera).
• Programming books for beginners.
• Forums and communities (e.g., Stack Overflow).
• Practice and Projects:
• Encourage students to work on coding projects.
• Suggest small coding challenges to enhance skills.
• Continuing Your Journey:
• Mention the importance of ongoing learning and practice.
• Explore advanced topics and specialized areas of interest.
DTC2301 Control Robotic Programing for Education
Agenda
1. Algorithms
2. Algorithm Design Principles
3. Common Algorithmic Problems
4. Algorithm Complexity
5. Algorithm Analysis

DTC2301 Control Robotic Programing for Education


1. Algorithms

• Definition: An algorithm is a precise set of instructions for solving a


specific problem or performing a task.
• Characteristics of Good Algorithms:
• Correctness: An algorithm should produce the correct output for all valid inputs.
• Efficiency: It should accomplish the task in a reasonable amount of time and
using a reasonable amount of resources.
• Clarity: Algorithms should be easy to understand and follow.
• Examples of Everyday Algorithms:
• Recipe: A cooking recipe is an algorithm for preparing a meal.
• Driving Directions: GPS navigation algorithms provide routes for drivers.
• Sorting Mail: Postal workers use algorithms to sort and deliver mail efficiently.

DTC2301 Control Robotic Programing for Education


2. Algorithm Design Principles

• Input and Output: Clearly define what data the algorithm takes as
input and what it produces as output.
• Step-by-Step: Break down the problem into smaller, manageable
steps.
• Reusability: Create algorithms that can be reused for similar tasks.
• Efficiency: Strive for algorithms that run quickly and use resources
effectively.
• Testing and Debugging: Test your algorithm with different inputs and
debug any issues.
• Optimization: Continuously look for ways to improve algorithm
performance.

DTC2301 Control Robotic Programing for Education


3. Common Algorithmic Problems

• Sorting Algorithms:
• Explain the importance of sorting data and mention popular sorting algorithms like Bubble Sort,
Quick Sort, and Merge Sort.
• Searching Algorithms:
• Discuss searching algorithms like Linear Search and Binary Search used to find elements in data.
• Recursion:
• Explain the concept of recursion and its application in algorithms.
• Dynamic Programming:
• Introduce dynamic programming as a technique for solving complex problems by breaking them
down into smaller subproblems.
• Graph Algorithms:
• Mention algorithms used for solving graph-related problems, such as Dijkstra's algorithm for
finding the shortest path.

DTC2301 Control Robotic Programing for Education


4. Algorithm Complexity

• Time Complexity: Explain the concept of time complexity in


algorithms, which measures how long it takes an algorithm to run
based on input size.
• Mention Big O notation and common time complexities (e.g., O(1), O(log n), O(n),
O(n^2)).
• Space Complexity: Describe space complexity, which measures the
amount of memory an algorithm uses.
• Mention common space complexities (e.g., O(1), O(n), O(n^2)).
• Importance: Emphasize the significance of understanding algorithm
complexity for optimizing performance.

DTC2301 Control Robotic Programing for Education


5. Algorithm Analysis

• Analyzing Algorithms: Discuss the importance of analyzing algorithms


to evaluate their efficiency and performance.
• Comparing Algorithms: Explain how to compare different algorithms
for the same task.
• Worst-Case, Average-Case, and Best-Case Analysis: Introduce the
concepts of analyzing algorithms under different scenarios.
• Practical Examples: Provide practical examples of algorithm analysis to
illustrate the concepts discussed.

DTC2301 Control Robotic Programing for Education


Agenda
1. System Theory
2. Flowchart
3. FlowGorithm

DTC2301 Control Robotic Programing for Education


System Theory
• Definition: System theory is an interdisciplinary approach that studies complex
systems as a whole, focusing on their interactions, components, and behaviors.

DTC2301 Control Robotic Programing for Education


System Theory
• Definition: System theory is an interdisciplinary
approach that studies complex systems as a
whole, focusing on their interactions, System
components, and behaviors.
• Key Concepts: Processing
• System: A set of interrelated components working
together to achieve a common goal.
• Processing: Processing refers to the manipulation,
analysis, and transformation of data or information Feedback
within a system.
• Subsystem: Smaller systems within a larger system,
each with its function.
• Inputs and Outputs: Information, energy, or matter
exchanged between the system and its environment.
• Feedback: The process of using system outputs to
make adjustments to system inputs or behaviors.
DTC2301 Control Robotic Programing for Education
1. Flowchart
• A flowchart is a graphical representation of an algorithm or
program. An algorithm is a set of instructions( finite ) that
solves the given problem. Flowchart diagrams are easy to
understand and visually represent the logical steps and flow of
the program. Flowcharts can be handwritten or drawn by pen
and pencil on whitepaper (old school).
• However, there are tools to create and execute flowcharts on
a computer. This way we can analyze the results, debug the
program and create effective flowcharts without errors.

DTC2301 Control Robotic Programing for Education


Flowchart
• Flowcharts can be generated in several ways and using
different tools.
• Pen, stencil, and paper.
• Computer-based tools.
• Online web/cloud-based Software.
• Flowchart tools can be computer-based or online cloud-based
tools. Computer-based flowchart software needs to be
installed on the computer you want to use.

DTC2301 Control Robotic Programing for Education


Flowchart
• Some of the free computer-based flowchart tools are:
• Flowgorithm. (Free)
• RAPTOR. (Free)
• Microsoft Office Tools. (MS Office License, Office 365 Subscription,
Windows PC MS Excel, MS Word)
• Visio
• LibreOffice/OpenOffice (Open-source alternatives to MS Office Tools.)
• Draw.io (Google marketplace plugin)

DTC2301 Control Robotic Programing for Education


Flowchart

Descriptive Trapezoid Gaddis GOST IBM SDL Block

DTC2301 Control Robotic Programing for Education


Flowchart Standard
ANSI: American National Standards Institute

DTC2301 Control Robotic Programing for Education


Flowchart Standard
ANSI: American National Standards Institute

ISO 5807:1985
Information processing — Documentation symbols and conventions
for data, program and system flowcharts, program network charts
and system resources charts

DTC2301 Control Robotic Programing for Education


ISO 5807:1985

ISO 5807:1985
Information processing — Documentation symbols and conventions
for data, program and system flowcharts, program network charts
and system resources charts

DTC2301 Control Robotic Programing for Education


2. FlowGorithm
• http://www.flowgorithm.org/download/index.html

DTC2301 Control Robotic Programing for Education


2. FlowGorithm

DTC2301 Control Robotic Programing for Education


FlowGorithm
Data Types
Data Type Notes Examples

Boolean Stores either Boolean true true, false


or false
Real Stores a real number. 23.82

Integer Stores an integer number. 81

String Stores textual data. “Hello”

DTC2301 Control Robotic Programing for Education


FlowGorithm
Data Types
Integer Data Type
• The Integer data type is one of the most commonly used types
in programming. An integer can store a positive or negative
whole number, but can't store fractional values. So, it can
store values such as 5, 42, 1947, but can't store numbers such
as 3.2, 4.5, etc...
• If a number with a fractional value is stored into a integer, the
fractional value will be discarded. Hence, if 3.2 is stored into
an integer, it will only retain 3.
DTC2301 Control Robotic Programing for Education
FlowGorithm
Data Types
Real Data Type
• The Real data type can store any number - both whole
numbers and ones with fractional values. In many languages,
this is called a "double" after the implementation standard
known as "double-precision floating point".

DTC2301 Control Robotic Programing for Education


FlowGorithm
Data Types
String Data Type
• The String data type is used to store any textual data. This
includes words, letters, or anything else you would send in a
text message. In programming, the text is delimited with
double quotes. For example: ”SSRU", ”Education", and
”SuanSunandha" are all strings.

DTC2301 Control Robotic Programing for Education


FlowGorithm
Data Types
Boolean Data Type
• The Boolean Data Type can store either "true" or "false". These
are the basis of decision making in a computer program.

DTC2301 Control Robotic Programing for Education


FlowGorithm
Expression
• The notation used for comparisons • Since mathematics and two
logical operators, etc... vary greatly major language families are
between different programming
languages. supported, there are redundant
• Flowgorithm supports the symbols operators. Flowgorithm
used in mathmetics (using considers the redundant
Unicode values) as well as the two operates as the same - and any
major families of programming set can be used (or all of them).
languages. The "BASIC-family"
contains English keywords and • This allows the student to use
operators. The "C-family" (which the operators that match the
includes C, Java, C#) is far more language they plan to to learn
symbolic.
later.
DTC2301 Control Robotic Programing for Education
FlowGorithm
Expression

DTC2301 Control Robotic Programing for Education


FlowGorithm
Expression

DTC2301 Control Robotic Programing for Education


FlowGorithm
Expression
Priority: High

Priority: Low
DTC2301 Control Robotic Programing for Education
FlowGorithm
Expression

DTC2301 Control Robotic Programing for Education


FlowGorithm
Expression

DTC2301 Control Robotic Programing for Education


FlowGorithm
Expression

DTC2301 Control Robotic Programing for Education


FlowGorithm
Expression

DTC2301 Control Robotic Programing for Education


FlowGorithm
Constant

DTC2301 Control Robotic Programing for Education


FlowGorithm
Assignment Shape
• The Assignment shape is
used to store the result of a
calculation into a variable.
This is one of the most
common tasks found in
programs.

DTC2301 Control Robotic Programing for Education


FlowGorithm
Breakpoint Shape
• The Breakpoint Shape
temporality halt the execution
of the program. This is useful
both for debugging programs
and for demonstrations. Most
professional software
development applications have
some form of the breakpoint.

DTC2301 Control Robotic Programing for Education


FlowGorithm
Call Shape function

call
• A Call Statement transfers
control to a function.
Information being passed into
the function are called
'arguments'.

Hello!

Goodbye!
DTC2301 Control Robotic Programing for Education
FlowGorithm
Comment
• Comments don't affect how your
program runs. They are used to
include documentation about the
program for other programmers.
These can include: the logic of a
loop, known issues, changes
made, future changes, etc..

DTC2301 Control Robotic Programing for Education


FlowGorithm
Declare Shape
• A Declare Statement is used to
create variables and arrays.
These are used to store data
while the program is running.
You can declare multiple
variables by separating the
names with commas.

DTC2301 Control Robotic Programing for Education


FlowGorithm
Input Shape The example, to the right, creates
two variables: 'area' and 'radius’.
• An Input Statement reads a It then uses an Input Statement to
value from the keyboard read the radius from the keyboard.
A final Output Statement then
and stores the result in a displays the result.

variable.

DTC2301 Control Robotic Programing for Education


FlowGorithm
Output Shape The example, to the right, creates
two variables: 'area' and 'radius’.
• An Output Statement It then uses an Input Statement to
evaluates an expression and read the radius from the keyboard.
A final Output Statement then
then displays the result on displays the result.

the screen.

DTC2301 Control Robotic Programing for Education


FlowGorithm
The example, to the right, declares
an integer called 'age'. It then
reads the age from the keyboard.

If-Else Shape Finally, an If Statement checks if


the age is greater than or equal to
18. Based on this, it either takes
• An If Statement checks a Boolean the false branch and displays
"Sorry, not yet", or takes the true
expression and then executes a true branch and displays "Go vote!".

or false branch based on the result.

DTC2301 Control Robotic Programing for Education


FlowGorithm The example, to the right, shows a
Do Statement that accepts only a
valid age as input.

Do-While Loop Shape It will loop while the 'age'


variable is less than 0 or greater
than 110.
• A Do Loop is similar to a While
Loop except that the block of 1

statements is executed at least


2
once before the expression is
checked. 5 if
True
3

DTC2301 Control Robotic Programing for Education


FlowGorithm
While Loop Shape The example, to the right, prints
the numbers from 1 to 100.

The assignment statement "n = n


• A While Loop evaluates a Boolean + 1" increments the variable 'n' by
1 for each iteration of the loop.
expression and then, if true, executes a
block of statements. After the
statements are executed, the While
Statement rechecks the expression.
When the expression is false, the loop
ends.

DTC2301 Control Robotic Programing for Education


FlowGorithm The example, to the right, prints
the numbers from 1 to 100. The

For Loop Shape


loop executes 100 times.

The value of 'n' starts at 1 and


increases by 1 each time the
loop executes. The loop ends
• For Loops increment a variable when 'n' reaches 100.

through a range of values. This is


a common, useful, replacement
for a While Statement.

1 100

DTC2301 Control Robotic Programing for Education

You might also like