+ All Categories
Home > Technology > Algorithm and Data Structures - Basic of IT Problem Solving

Algorithm and Data Structures - Basic of IT Problem Solving

Date post: 21-May-2015
Category:
Upload: coolpie
View: 794 times
Download: 3 times
Share this document with a friend
Description:
IT Basics, Algorithm, Data Structures, Programming Concepts
Popular Tags:
27
Algorithm and Data Structures as the basic of IT Problem Solving Christian A – Mei 2014 Training Material
Transcript
Page 1: Algorithm and Data Structures - Basic of IT Problem Solving

Algorithm and Data Structures as the basic of IT Problem Solving

Christian A – Mei 2014

Training Material

Page 2: Algorithm and Data Structures - Basic of IT Problem Solving

• Information Technology Overview– Theoretical– Engineering –Management

• Programming Principles• Algorithm • Data Structures• Programming Concepts

Topics

Page 3: Algorithm and Data Structures - Basic of IT Problem Solving

• Discrete Mathematics– Number Theory– Set Theory, Relation, Function– Combinatorics, Probability– Graph– Logic, Proof Theory

• Formal Foundation:– Automata– Turing Machine (model of computation: 1970 – now)

• Computer Architecture– Von Neumann Architecture:

stored program architecture

• Computer Science (birth of : 1937-1970)– Theory of Computation– Branches:

• Automata Theory• Computability Theory• Computational Complexity Theory

Information Technology - Theoretical

Page 4: Algorithm and Data Structures - Basic of IT Problem Solving

• Programming• Software Engineering:

– Requirement, Analysis, Design, Implementation• Database• Computer Networks• Computer Security

Information Technology - Engineering

Page 5: Algorithm and Data Structures - Basic of IT Problem Solving

• Project Management• Enterprise IT Architecture• IT Governance• IT Strategic Planning

• R

Information Technology - Management

Page 6: Algorithm and Data Structures - Basic of IT Problem Solving

“Algorithm + Data Structures = Program” – Nicklaus Wirth (Father of Computer Science), Creator of Pascal Language

“Program Cost: Time vs Space” CPU Time vs Memory

“Program: Input – Process - Output”

Programming Principles

Page 7: Algorithm and Data Structures - Basic of IT Problem Solving

• Dynamic aspect of a program• Sequence of steps to solve a problem

– Have a problem definition– Have specific input– Operate on specific data structure

(problem model)– Produces output

• Popular algorithm maybe named for easy communication

• Example:• Problem: sorting

– Input: array– Data structure: array– Output: array– Algorithm: Bubble Sort, Quick

Sort, Merge Sort, etc

Algorithm and Data Structure

• Static aspect of a program• Representation of a problem (model)• The structure / shape of the data (to be

processed)• Is subject to be processed by an

algorithm• Common data structures is named• Example:

• Array• List• Map• Stack• Queue• Matrix• Graph• etc

ALGORITHM DATA STRUCTURE

Page 8: Algorithm and Data Structures - Basic of IT Problem Solving

Algorithm and Data Structure - Example• Problem: Find shortest path between a

source vertex and destination vertex• Input:

– Source vertex– Destination vertex– Weighted graph

• Output:– Shortest Path

• Algorithm: Dijkstra Algorithm

Page 9: Algorithm and Data Structures - Basic of IT Problem Solving

• Pseudocode: a pseudo programming language to describe algorithm that will be understandable by a human reader, facilitates communication

• Programming: activity that translates the algorithm in the mind of the programmer into specific Computer Language

• Program Source Code: for Computer or Human ?• Human:

– Readibility– Understandibility– Clarity– Structure– Focus on the semantic (meaning)

• Computer:– Executes binary instructions (bits)– Source code is translated into binary instructions (machine language)– Translation: Focus on the syntactic (what is written)

Pseudocode

Page 10: Algorithm and Data Structures - Basic of IT Problem Solving

• Variable• Data Type• Operators• Control Structures• Subprogram• Abstract Data Type

Programming Concepts - Basic

Page 11: Algorithm and Data Structures - Basic of IT Problem Solving

• A location in memory to store a value while a program is in execution

• Variable has:– Name (label)– Type (allowed values)– Value

• Operation:– Declaration– Initialization– Assignment (Write)– Read

Variable

Page 12: Algorithm and Data Structures - Basic of IT Problem Solving

• Classify/restrict possible values that can be given to a data (domain values)• Have a specific operations• Have a name

• Primitive/Basic Data Types:– Numeric:

• Integer: byte, short, int, long• Real/Float: float, double

– Boolean– Character

• Composite Data Type– Derived from multiple primitive data types– Combines into data structures– Example:

• String• Collection: Array of T, List of T, Map of <T1,T2>, Set of T• Struct / Record { T1 f1, T2 f2, …}• Class

Data Type

Page 13: Algorithm and Data Structures - Basic of IT Problem Solving

• Specific operations on a data type

• Arithmetic : Numeric, Numeric -> Numeric• Ex: addition, subtraction, multiplication, division, modulo

• Relational: Numeric, Numeric -> Boolean• Ex: less than, less than or equal, greater than, greater than or equal, equal, not

equal• Logic : Boolean, Boolean -> Boolean

• Ex: not, and, or

• String operations:• Ex: concat, substring, index of, length, …

Operators

Page 14: Algorithm and Data Structures - Basic of IT Problem Solving

• Literal– Written text that represents a value that have a type– Integer literal: 1, 1000, -1– Float literal: 1.001, -0.2, -2E-03– Boolean literal: true, false– String literal: “hello”, “Jakarta”, “”

• Expression– Combination of values that evaluates to a value– 2+3– sin(pi)– x– x+3

• Statement– A single program action

• Block– Combination of several statement considered as a single statement (block statement)

• Recursion– A subprogram activity that calls itself

Programming Concepts

Page 15: Algorithm and Data Structures - Basic of IT Problem Solving

• Mechanism to controls the flow of the program

• Sequence• Conditional• Loop

Control Structures

Page 16: Algorithm and Data Structures - Basic of IT Problem Solving

• Basic sequential actions flow

statement 1;statement 2;statement 3;…

Control Structures - Sequence

Page 17: Algorithm and Data Structures - Basic of IT Problem Solving

• Conditional / choice / selection of actions based on a boolean condition

IF If condition then statement;

IF-ELSEif condition then statement 1;else statement 2;

Control Structures - Conditional

Page 18: Algorithm and Data Structures - Basic of IT Problem Solving

• if-else-if-else …. visually forms a decision tree• Make sure all possibilities have been covered !

Control Structures – Decision Tree

Page 19: Algorithm and Data Structures - Basic of IT Problem Solving

• Conditional loop– while-do– do-while / repeat-until

• Iteration– Using a counter variable– Over a collection (foreach)

• Loop control statement:– Break statement– Continue statement

Control Structures – Loop

Page 20: Algorithm and Data Structures - Basic of IT Problem Solving

• while-do– Checks condition at top– Loop Statement may /may not execute

• do-while– Checks condition at bottom– Loop Statement executed at least once

Control Structures – Conditional Loop

Page 21: Algorithm and Data Structures - Basic of IT Problem Solving

• for: index style– Using integer index for loop condition– While-do in compact form

• for-collection iteration– Iterates over each element in collection– No need for index

Control Structures – Iteration

Page 22: Algorithm and Data Structures - Basic of IT Problem Solving

• Break– Used to exit loop immediately– Application: searching

• Continue– Used to skip next process and proceed

to next iteration– Application: filtering

Control Structures – Loop - Break/Continue

Page 23: Algorithm and Data Structures - Basic of IT Problem Solving

• A program may divided into subprograms, or use existing subprograms• Each subprogram perform specific tasks• A program /sub program may call another sub program

– A call to a subprogram may pass data to that subprogram (parameter, argument)– A call to a subprogram may return an output

• Main Program: program that initiates the main flow of control

• Subprogram types:– Procedure: performs tasks, do not return an output– Function: perform tasks and returns an output

• Parameter/argument types:– Formal parameter: parameter that’s declared for the subprogram– Actual parameter: actual value that’s passed to the subprogram

• Signature:– Combination of input parameter types and output/return types

• double sin(double x) : double -> double• int add(int x, int y) : int, int -> int• void hello () : () -> void

Subprogram

Page 24: Algorithm and Data Structures - Basic of IT Problem Solving

Data Structures

Engineering Structures

Data Structures

Structure:• Something arranged in a definite pattern

of organization • Organization of parts as dominated by

the general character of the whole

Page 25: Algorithm and Data Structures - Basic of IT Problem Solving

• Compound Data type that contains multiple data each with the same type• Array of T:

– Fixed size/length at allocation– Static: May not grow– Access: by index (direct access)

• List of T:– Zero size at allocation– Dynamic: may grow (add, remove)– Access: by index (involves loop)

• Map of <T1,T2>:– Map from an KEY type to VALUE type– Example: to associate a Student with his Student Number– Dynamic/may grow: put, remove– Access: by key (direct access)

• Set of T:– Dynamic collection of elements from type T– Order is not guaranteed– Each element must be unique in the set

Data Structures - Collection

Page 26: Algorithm and Data Structures - Basic of IT Problem Solving

• Data structures that represents an abstract concept – Provide abstraction to a concept– Provide encapsulation (hide internal implementation details)– Provide specific operations

• Example:– Stack: a concept that can be “created” from a array or list (the internal

implementation)– Stack operations:

• void push (Stack s, T elem)• T pop (Stack s)• boolean isEmpty(Stack s)• T getTop(Stack s)

Data Structures – Abstract Data Type

Page 27: Algorithm and Data Structures - Basic of IT Problem Solving

Tanya Jawab

Christian AEmail: coolpie at gmail.com

Q & A


Recommended