Download presentation
Published byClarissa Kelley Cobb Modified over 8 years ago
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) Boolean Integer Float, double
Signed or Unsigned Boolean Integer Long or short Float, double String
4
Stack Interfaces (Allowed Operations) Push Pop
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 Dequeue FIFO (First In First Out)
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 6 7 5 3 2 9
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 < polynomial < 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, (p+q)/2); merge_sort(A, (p+q)/2+1, 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 Finding what? Linear Search Binary Search Hash Search
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.