1. (20) How many ways are there to choose 6 objects from 10 distinct ones when
(a) the order in which the objects are chosen matters and repetition is not allowed?
Answer. P (10, 6) = 10 9 8 7 6 5 = 1
IIIa. Linked List
This is the definition of a linked list node:
struct Node
cfw_
int data;
Node * next;
Write the following function in C+. You may use any other data structures you wish for assi
Artificial Intelligence Assignment 2
February 8th, 2017
I have not received unauthorized aid on this assignment. I understand the answers that I have
submitted. The answers submitted have not been dir
ADT: Design & Implementation
Dr. Yingwu Zhu
Outline
Concept: ADT
Demonstration of ADTs design and
implementation
List as an ADT (our focus)
Stack & Queue as ADTs (exercises)
Abstract Data Type (AD
Quicksort
Dr. Yingwu Zhu
Quicksort
A more efficient exchange sorting scheme than
bubble sort
A typical exchange involves elements that are far apart
Fewer interchanges are required to correctly pos
Hashing
Dr. Yingwu Zhu
What do I have?
Recall order of magnitude of searches
Linear search O(n)
Binary search O(log2n)
Balanced binary tree search O(log2n)
Unbalanced binary tree can degrade to O
Tree Balancing: AVL Trees
Dr. Yingwu Zhu
Recall in BST
The insertion order of items determine the
shape of BST
Balanced: search T(n)=O(logN)
Unbalanced: T(n) = O(n)
Key issue:
Need to keep a BST
Algorithm Complexity Analysis: Big-O
Notation (Chapter 10.4)
Dr. Yingwu Zhu
Measure Algorithm Efficiency
Space utilization: amount of memory
required
Time efficiency: amount of time required to
acco
Binary Search Trees (BST)
Dr. Yingwu Zhu
Review: Linear Search
Collection of data items to be searched is
organized in a list
x1, x2, xn
Assume = and < operators defined for the
type
Linear search
Review: C+ Basic Concepts
Dr. Yingwu Zhu
Outline
C+ class declaration
Constructor
Overloading functions
Overloading operators
Destructor
Redundant declaration
A Real-World Example
Question #1: How to
Basic Sorting Algorithms
Dr. Yingwu Zhu
Sorting Problem
Consider list
x1 , x 2 , x 3 , x n
Goal: arrange the elements of the list in
order
Ascending or descending
Some O(n2) schemes
easy to understand
Introduction
Dr. Yingwu Zhu
What to learn?
ADT design & implementation using different
data structures
Algorithm time efficiency analysis by Big-O
ADTs operations & applications
Binary search tree
CPSC 250 Data Structures by Dr. Zhu
Homework Assignments #1
Due by 9:20AM, Sept 30, Friday
1. Goals
This assignment aims to further understanding of some basic C+ concepts weve discussed in class,
whi
Solutions to Mid-Term Exam #1
Part I: Algorithm Efficiency Using Big-O Notations. (16 points)
1. True
2. Since T(n) = O(n2), we have
T(n) Cn2
(where C is a constant)
3
C n
(where n 1)
3
= O(n )
3. T(
CPSC 250 Fall 2011
Lab 1:Get familiar with Linux
By Dr. Yingwu Zhu, Seattle University
Tasks (You should perform the following tasks step by step):
1.
2.
3.
4.
5.
Check out your CS1 account
Set up you
Assignments #2
Due by 9:20 AM, Wednesday, 10/12/2011
Note: 16 points in total. Hardcopy submission is required! Please staple your
HW solution papers if it has multiple pages!
1. Explain why, if T(n)
Multi-core Architectures
Dr. Yingwu Zhu
What is parallel computing?
Using multiple processors in
parallel to solve problems more
quickly than with a single
processor
Examples of parallel computing
A
Virtualization
Dr. Yingwu Zhu
What is virtualization?
Virtualization allows one computer to do the
job of multiple computers.
Virtual environments let one computer host
multiple operating systems at
Synchronization
Dr. Yingwu Zhu
Concurrency
Concurrent threads/processes
The threads run at the same time in multiprocessing
environments or their execution is interleaved through
preemption
Asynchr
Signals & Shared Memory
Dr. Yingwu Zhu
Topics
Signals
Shared memory for IPC
Question
Q: How does the OS communicate to a
process?
A: Signals
Signals
What if something unexpected or
unpredictable