Sorting
Tutorial 6: Introduction to ecient sorting
algorithms
Xin Wang
Xin Wang
Tutorial 6: Introduction to ecient sorting algorithms
Sorting
Merge sort
Quick sort
Sorting
A sorting algorithm is an algorithm that puts elements of a list in a
certain order
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 2864B
Quiz 5A Solution
1. Use Monte Carlo integration based on 100000 uniform pseudorandom numbers to estimate
1
I=
sin x2 log(x + 1) dx.
0
>
>
>
>
n
2. Introduction to the R Language
The rst step is to learn the syntax of the language that you
will be programming in; you need to know the rules of the
language.
This is the objective of the current set of slides.
1
Named storage
R has a workspace known
Chapter 3 Programming Statistical Graphics
The main graphic system is known as base graphics. The
grid library provides the basis for a newer graphics system.
We will study this later.
Other libraries, such as lattice and ggplot provide functions for high
Simulation
Monte Carlo Simulation
These slides describe how to simulate random variables on a
computer.
We will describe deterministic methods of generating values,
which are then treated as though they are random.
Simulated random numbers are called pseu
Programming with R
1
Some General Programming Guidelines
1. Understand the problem.
2. Work out a general idea how to solve it.
3. Translate your idea into a detailed implementation.
4. Check: Does it work?
Is it good enough?
If yes, you are done!
If no,
The University of Western Ontario
Department of Statistical and Actuarial Sciences
SS 2864B Introduction to Statistical and Actuarial Computing
Term Test
Duration: 50 minutes
Date: 2 March 1879
Time: 3:30 PM
Instructions: Answer all questions in the accom
Programming with R
Computer programming often involves the use of repeated commands or statements.
We will describe several functions that control how many times
statements are repeated.
We will next describe R functions and how to construct them.
Later w
The University of Western Ontario
Department of Statistical and Actuarial Sciences
SS 2864B Introduction to Statistical and Actuarial Computing
Final Examination
Duration: 3 hours
Date: 27 April 1878
Instructions: Answer all questions in the accompanying
Charles M. Grinstead and J. Laurie Snell: INTRODUCTION to PROBABILITY Published by AMS Solutions to the exercises SECTION 1.1 1. 3. 5. 7. 9. As n increases, the proportion of heads gets closer to 1/2, but the difference between the number of heads and hal
Quiz 3 Solutions
Statistics 2864
Copyright A. I. McLeod, 2015
Comments on the Quiz
The Quiz is out of 4 since there was an error in Question 2, see comments below. The distribution
of scores is shown below. Out of 114 students, 73 received a perfect score
Searching
Tutorial 8: Introduction to searching algorithm
Xin Wang
Xin Wang
Tutorial 8: Introduction to searching algorithm
Searching
Binary search
The binary search algorithm is used to nd the position of the key
value in the ordered array. In the algori
Genetic Algorithms
Tutorial 10: Introduction to Genetic Algorithms I
Xin Wang
Xin Wang
Tutorial 10: Introduction to Genetic Algorithms I
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms (GA) is proposed by Prof. John Holland in the
University of M
Sorting
Tutorial 6: Introduction to elementary sorting
algorithms
Xin Wang
Xin Wang
Tutorial 6: Introduction to elementary sorting algorithms
Sorting
Bubble sort
Selection sort
Insertion sort
Sorting
A sorting algorithm is an algorithm that puts elements
Department of Statistical and Actuarial Sciences. University of Western Ontario
Room 262 Western Science Centre. Phone: 519-661-3607. Fax: 519-661-3813
Statistical Programming 2014/2015
Statistical Science 2864B Section 001
Course Outline
Instructor Infor
Quiz 4
Statistics 2864 B
Copyright Jinkun Xiao & A. I. McLeod, 2015
Student performance
Test remarked and the scores are much improved. Four students received a perfect score. Students who were absent or received 0 were dropped from the statistical analys
Revised Solutions to Quiz 2
Statistics 2864, Copyright A. I. McLeod, 2015
The questions and answers below are not in the same order as appeared on the online version.
Due to a typo there were 2 correct answers to question 5.
115 students completed Quiz 2
Solutions to Quiz 1
Statistics 2864, Copyright A. I. McLeod, 2015
The questions and answers below are not in the same order as appeared on the online version.
The R code to produce the answers is shown in the last section.
There was an error in Question 2
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 2864B
Assignment 4
Due Date: March 24, 2011
Please work together with one, two or three partners on this assignment. Print the names of all
group membe
The University of Western Ontario
Department of Statistical and Actuarial Sciences
SS 2864B Introduction to Statistical and Actuarial Computing
Term Test
Duration: 50 minutes
Date: 2 March 2012
Time: 4:30 PM
Instructions: Answer the rst 4 questions in the
1
The University of Western Ontario
Department of Statistical and Actuarial Sciences
Statistical Sciences 2864B
Assignment 3
Due Date: March 7, 2011
Please work together with one or two partners on this assignment. Print the names of all
group members at