0% found this document useful (0 votes)
15 views

Lecture 01 IntroductionToAlgorithm

Intro

Uploaded by

Prateek Potdar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Lecture 01 IntroductionToAlgorithm

Intro

Uploaded by

Prateek Potdar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

SC1007

Data Structures and


Algorithms
Introduction

Dr. Loke Yuan Ren

College of Engineering [email protected]


School of Computer Science and Engineering N4-02B-69A
Course Schedule
Week Lecture Topic Tutorial Lab Assignment Deadline
1 Introduction to Data Structure
2 Introduction Linked List (LL)
3 Linked List (LL) – Linear Search T1 (LL)
4 Stack and Queue (SQ) – Arithmetic Operations Makeup T1(LL) Lab 1 (LL)
5 Binary Trees (BT) and Binary Search Trees T2 (SQ) Lab 2 (SQ) AS1: LL (10/02/2023)
6 Binary Trees - Binary Search and AVL Trees Lab 3 (BT) AS2: SQ (17/02/2023)
7 Analysis of Algorithm (AA) T3 (BT & BST) Lab 4 (BST) AS3: BT (24/02/2023)
Lab Test 1 (Recess Week: 02/03/2023)
8 Hash Table T4 (AA)
9 Basic Graph (G) Lab 5 (Hash Table)
10 DFS + backtracking/ Permutation T5 (Hash Table) Lab 6 (Graph) AS4: Hash Table
11 Dynamic Programming Lab 7 (Backtracking)
12 Permutation / Matching T6 (Graph) Lab 8 (DP) AS5: Graph
13 Revision Makeup Lab 8 AS6: Permutation/ Matching
14 Lab Test 2 + Quiz (20/04/2023)
Learning Outcomes
1. Select appropriate data structures
2. Implement algorithms to solve real world problems using C
programming
3. Conduct complexity analysis of algorithms
Week Lecture Topic Tutorial Lab Assignment Deadline
1 Introduction to Data Structure
Assessment Components:
2 Introduction Linked List (LL)
3 Linked List (LL) – Linear Search T1 (LL)
Assessments Weighting
4 Stack and Queue (SQ) – Arithmetic Operations Makeup T1(LL) Lab 1 (LL)
Assignments 40%
5 Binary Trees (BT) and Binary Search Trees T2 (SQ) Lab 2 (SQ) AS1: LL (10/02/2023)
6 Binary Trees - Binary Search and AVL Trees Lab 3 (BT) AS2: SQ (17/02/2023)
7 Analysis of Algorithm (AA) T3 (BT & BST) Lab 4 (BST) AS3: BT (24/02/2023) Two Lab Tests 40%
Lab Test 1 (Recess Week: 02/03/2023)
8 Hash Table T4 (AA)
9 Basic Graph (G) Lab 5 (Hash Table)
Final Quiz 20%
10 DFS + backtracking/ Permutation T5 (Hash Table) Lab 6 (Graph) AS4: Hash Table Part 1 and Part 2 concepts
11 Dynamic Programming Lab 7 (BT)
12 Permutation / Matching T6 (Graph) Lab 8 (DP) AS5: Graph The attendance of tests is compulsory.
13 Revision Makeup Lab 8 AS6: Permutation/ Matching
14 Lab Test 2 + Quiz (20/04/2023)
Computer Science Programme Structure
SC1003
MH1812 SC1015
MH1810 Introduction to
Discrete Introduction to Data
Mathematics I Computational SC1005
Mathematics Science & Artificial
Thinking & Digital Logic
Intelligence
Programming

SC1006
Computer
SC1007 Organisation &
SC2000 SC1004
Data Structures &
Probability Linear Algebra Architecture
Algorithms
Statistic for for Computing
Computing
SC2002 SC2005
SC2001 SC2207 SC2006 Operating
Algorithm Design Introduction Object Oriented
Software Systems
SC2008 Design &
& Analysis to Databases Engineering
Computing Networks Programming

SC3010
SC3000 SC3020 Computer
SC3030 Artificial Database System Security
Advanced Intelligence Principles
Computer Networks
Session Objectives
• Lectures focus on introduction to concepts
• Tutorials focus on understanding the concepts, discussion and doubt
clarification
• Lab sessions and assignments focus on practice
• Lab tests and quiz are assessments
Overview of SC1007
Data Structures:
• Concepts of pointers and structures (aggregates)
• Introduce some classical data structures
• Linear: Linked list, stack, queue
• Non-linear: tree
• Implement these data structures

Algorithms:
• Analysis of Algorithm – time complexity and space complexity
• Introduce to some typical algorithms and their applications
• Introduce to some algorithm design strategies

Implementation:
• C programming
Overview
• What is an algorithm?
• Problem types in computing
• Algorithm design strategies
Algorithm
• Appear in Webster’s New World Dictionary
after 1957
• It is derived from the name of a Persian
Mathematician in the 9th century.
• Euclidean algorithm for finding the greatest
common divisor of two numbers – Euclid’s
Elements (300B.C.)

https://en.wikipedia.org/wiki/Algorithm
Knuth’s The Art of Computer Programming
Algorithm
• An algorithm is a sequence of unambiguous instructions for solving a
problem, i.e., for obtaining a required output for any legitimate input
in a finite amount of time.
Introduction to The Design & Analysis of Algorithms
-Anany Levitin
• An algorithm is any well-defined computational procedure that takes
some value, or set of values, as input and produces some value, or set
of values, as output.
Introduction to Algorithms
-T. H. Cormen et. al.
Algorithm
• Correctness:
• Output results must be correct and consistent for every given input instance
• Precision:
• A series of well-defined and systematic steps
• The steps should not contain any ambiguous word like maybe, roughly, about
etc.
• Finiteness:
• Terminates in a finite number of instructions
Algorithm VS Program
• A computer program is an instance, or concrete representation of an
algorithm in some programming languages.

• Implementation is the task of turning an algorithm into a computer


program.
Problem

Algorithm

Input Program Output


Example 1: Arithmetic Series
• There are many ways (algorithms) to solve a problem
• Summing up 1 to n
Example 2: Fibonacci Sequence
Which is better algorithm?
• 1, 1, 2, 3, 5, 8, …
• The nth term is
𝑓 𝑛 = 𝑓 𝑛 − 1 + 𝑓(𝑛 − 2)

Is there any better algorithm?


Problem Types
• Searching
• Graph Problems
• Combinatorial Problems
• Sorting (CZ2101)
• String Processing (CZ2101)
• Geometric Problems
• Numerical Problems
Searching: Find a search key in a given set
20

7 15 77 1 20 32 19 53

Linear Search/ Sequential Search Hash Table


Index Data
001 Tom, +123456
002 Harry, +369852
Tom 003 Dick, +965483

Dick Hash .. …
… …
Harry
.. ..
Sudoku .. ..
Graph Problems 4 12
A graph is a mathematical structure consisting of a 11
collection of vertices and edges. 1
8
Each edge has one or two vertices associated to it. 3

2
5 6 7

9 10

https://forio.com/app/showcase/route-optimizer/
Path Finding Traveler Salesman Problem
Combinatorial Problems
• The study of arrangements, patterns, designs, assignments schedules,
connections and configurations.
• Cryptography:
• Information Transmission
Message Encoder Decoder Message

• Matching and Covering Problem


Tom Cutting

Harry Polishing

Dick Packaging Minimum Vertex Cover Problem


Sorting Problems
Numerical Order
• Rearrange items of a given list in certain order
Lexicographical Order
• Find the top 5% of students in a class
• Find the median

7 15 77 1 20 32 19 53 19.5

• Stability: Stable sorting algorithms sort repeated elements in the


same order that they appear in the input.
String Processing
• String matching
PNEUMONOULTRAMICROSCOPICSILICOVOLCANOCONIOSIS

M I C R O

SARS-CoV- Severe acute respiratory syndrome


Text Matching 2/human/USA/UNC_200265_2020/2020 coronavirus 2 isolate Wuhan-Hu-1,
, complete genome complete genome.
Computational Geometric Problem
Convex Hull
• Finding the convex hull of a set of points
• Finding the closest pair of points in a set of points
• Finding the intersection of two line segments or two circles
• Testing whether a point is inside or outside a polygon
• Finding the Voronoi diagram of a set of points Delaunay Triangulation

• Finding the shortest path between two points in a planar graph with
obstacles
• Constructing a Delaunay triangulation Computing the area of a polygon or
the volume of a polyhedron
• Detecting and resolving collisions between objects in a 2D or 3D space
Numerical Problem and Optimization Problem
• Use numerical approximation for the mathematical analysis
• Widely used for solving problems of engineering and mathematical models
• Newton’s method
• Gaussian elimination
• Linear programming is an optimization technique for a system of linear
constraints and a linear objective function
min 3𝑥 + 5𝑦
subject to 5𝑥 + 3𝑦 ≥ 29
−2𝑥 + 𝑦 ≤ 6
2𝑥 + 5𝑦 ≤ 66
7𝑥 − 4𝑦 ≤ 16
How do we solve these problems?
How do we solve these problems?

• Select appropriate data structures


• Arrays
• Linked Lists
• Singly linked list, doubly linked list, circular linked list etc.
• Stack and Queue
• Trees
• Table
• Graphs

• Recursive and non-recursive concepts and their implementation


Algorithm Design Strategies
A general approach to solving problems algorithmically that is
applicable to a variety of problems from different areas of computing

• Brute Force and Exhaustive • Decrease-and-Conquer


Search • Transform-and-Conquer
• Divide-and-Conquer • Iterative Improvement
• Greedy Strategy
• …etc.
Summary
• An algorithm is not simply a computer program
• Computing Problems
• Searching
• Graph Problems etc.
• Algorithm Design Strategies
• Brute-force
• Divide-and-Conquer
• Decrease-and-Conquer
• Transform-and-Conquer
• Infix expression to Postfix expression

• Lectures focus on introduction to concepts


• Tutorials focus on understanding the concepts, discussion and doubt clarification
• Lab Sessions and assignments focus on practice and realization
• Lab Tests and quiz are assessments

You might also like