Introduction to Data Structure and Algorithms - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Introduction to Data Structure and Algorithms

Description:

FILO (First In Last Out) Queue. Interfaces. Enqueue ... What is Algorithms ... Example: Sorting problem. Input: A sequence of n numbers. Output: A permutation ... – PowerPoint PPT presentation

Number of Views:731
Avg rating:3.0/5.0
Slides: 29
Provided by: star7CsN
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Data Structure and Algorithms


1
Introduction to Data Structure and Algorithms
  • Chuan-kai Yang

2
Data Structures
  • Basic Data Types
  • Stack
  • Queue
  • Linked-List
  • Array
  • Heap, Priority Queue
  • Binary Search Tree
  • Hash Table

3
Basic Data Types
  • Character (Byte, Octet)
  • Signed or Unsigned
  • Boolean
  • Integer
  • Signed or Unsigned
  • Long or short
  • Float, double
  • String

4
Stack
  • Interfaces (Allowed Operations)
  • Push
  • If a stack is not full, this adds one element on
    the top of a stack
  • Pop
  • If a stack is not empty, this removes one element
    from the top of a stack
  • FILO (First In Last Out)

5
Queue
  • Interfaces
  • Enqueue
  • If a queue is not full, add one element at the
    tail of a queue
  • Dequeue
  • If a queue is not empty, remove one element from
    the head of a queue
  • FIFO (First In First Out)

6
Linked-List
  • Singly-linked lists
  • Doubly-linked lists
  • Circular-linked lists

Search, Insert, Delete
7
Array
1
2
3
4
5
6
7
8
9
1
10
9
7
5
3
2
9
6
8
Heap
Max_Extract, Insert, Delete
9
Binary Search Tree
Search, Insert, Delete, Successor, Predecessor
10
Hash Table
11
Hash Table Chaining
12
Hash Table Open Addressing
13
Algorithms
  • What is algorithm?
  • Time Complexity Space Complexity
  • Growth of Functions
  • Recurrence relation
  • Sorting
  • Searching
  • Graph Algorithm
  • Computational Geometry

14
What is Algorithms
  • Algorithm Any well-defined computation procedure
    that takes some value, or set of values, as input
    and produces some value, or set of values, as
    output.
  • Or tool for solving well specific computational
    problem.
  • Example Sorting problem
  • Input A sequence of n numbers
  • Output A permutation
  • of the input sequence such that .

15
Time Space Complexity
  • Time complexity
  • Time to run an algorithm
  • Worst-Case, Best-Case, Average-Case
  • Space complexity
  • (Memory) Capacity to run an algorithm

16
Growth of Functions
  • Log lt polynomial lt exponential
  • Constant time c
  • Logarithmic time log(n)
  • Linear time cn
  • Quadratic time cn2
  • Exponential time cn

17
Recurrence Relation
  • merge_sort(A, p, q) merge_sort(A, p,
    (pq)/2) merge_sort(A, (pq)/21, q)
    merge(A, p, q)
  • T(n)2T(n/2)O(n)

18
Sorting
  • Insertion Sort
  • Selection Sort
  • Quick Sort
  • Counting Sort

19
Searching
  • Method
  • Linear Search
  • Binary Search
  • Hash Search
  • Finding what?
  • If a data structure has some element
  • Finding the n-th smallest element
  • Finding the successor/predecessor

20
Graph Algorithm
  • Minimal Spanning Tree
  • Shortest Path
  • Euler Path/Cycle
  • Hamiltonian path/Cycle
  • Travelling salesman

21
Minimal Spanning Tree
22
Shortest Path
23
Euler Path/Cycle
24
Hamiltonian Path/Cycle
25
Traveling-Salesman Problem
26
Computational Geometry
  • Line-segment intersection
  • Convex hull
  • Voronoi diagram

27
Convex Hull
28
Voronoi Diagram
Write a Comment
User Comments (0)
About PowerShow.com