Chapter 1 Fundamentals of the Algorithms
Definition of Algorithm An algorithm is a finite sequence of precise
instructions for performing a computation or for solving a problem.
Example 1 Describe an algorithm for finding the maximum (largest) value in a

Project 2
Task 1: Design, analyze and implement the algorithm of computing Huffman code .
Input: 26 English characters (your can add some other characters, such as space, , .)
and their frequencies (the sum of the frequencies is 100).
Output: Huffman code

Project 1
Task 1: Using Divide-and-conquer technique to design, analyze and implement a
Binary Search Tree (BST) which support:
(1) Search, (2) Insertion, (3) Transversal, (4) Finding the height of the BST,
and (5) Finding the size of the BST
Requirements

Strings and Pattern Matching Algorithms
Pattern P[0.m-1]
Text T[0.n-1]
Brute Force Pattern Matching
Algorithm BruteForceMatch(T,P):
Input: Strings T with n characters and P with m characters
Output: String index of the first substring of T matching P, or

Strings and Pattern Matching Algorithms
Pattern P[0.m-1]
Text T[0.n-1]
Brute Force Pattern Matching
Algorithm BruteForceMatch(T,P):
Input: Strings T with n characters and P with m characters
Output: String index of the first substring of T matching P, or

Graph Algorithms
Data structure for graph algorithms: Adjacent list, Adjacent
matrix
G (V , E )
V (a, b, c, d , e, f )
E cfw_( a, c), (b, c), (d , a), (c, e), (e, c ), (b, f ), (d , e), (e, f )
a
c
b
d
e
f
c
a
c
f
b
e
c
a
e
d
f
c
e
f
Adjacent lists
a b c

Limitation of Computation Power
P, NP, and NP-complete
Class P
Definition 1 Class P is a class of decision problems that can be solved in
polynomial time by (deterministic) algorithms. This class of problems is
called polynomial.
Class NP
There is a larg

Chapter 4 Abstract Data Structures and Implementation
4.2 Implementation of Abstract Data Structures
3. FIFO Queue Implemented by Array
Operations a queue supports: first-in-first-out (enqueue, dequeue)
Implementation: using an array (need to check if t

Chapter 3 Heap
Definition 1 A max-heap (or min-heap) A is an array object that can be reviewed as a
complete binary tree (each node has two children, except the right part of the last level)
, where at each node, there is a key which is larger (or smaller

Chapter 4 Abstract Data Structures and
Implementation
4.1 Fundamental/Physical Data Structures
1. Array
a[1] a[2] a[3]
a[n]
2. Link List
Head of list
a1
a3
a2
3. Binary Search Tree
an
15
6
3
1
18
7
17
13
4
9
20
4. Heap
A[0]
A[0] A[1] A[2] A[3] A[4] A[5] A

Chapter 0: (A) Review of Computer Programming
1. Loop, Control and Functions
Example 1: Calculate the Summation
public int Summation(int[] arr, int n)
cfw_ int sum;
sum = 0;
for (int i = 0; i <= n - 1; i+) loop
sum = sum + arr[i];
return sum;
function/me

Chapter 8 Dynamic Programming (Planning)
Divide-and-Conquer & Dynamic Programming
Divide-and-Conquer: Divide a problem to independent subproblems, find the
solutions of the subproblems, and then merge the solutions of the subproblems to the
solution of th

Chapter 3 Brute Force
Brute force is a straightforward approach to solving a problem, usually
directly based on the problems statement and definitions of the concepts
involved.
2n
Example 1 Compute a .
Brute force algorithm:
A better algorithm:
n
2 1
tim

Select a data structure for supporting Dynamic Dictionary
Definition 2
A Dynamic Dictionary is a data structure of item
with keys that support the following basic operations:
(1) Insert a new item
(2) Remove an item with a given key
(3) Search an item wit

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace studentDoubleLinkList
cfw_
public struct student
cfw_
public int id;
public string name;
public float GPA;
public class Node
cfw_
public student item;
public