Lecture 26. Sequence Algorithms (Continued)

Size: px
Start display at page:

Download "Lecture 26. Sequence Algorithms (Continued)"

Transcription

1 Lecture 26 Sequence Algoritms (Continued)

2 Announcements for Tis Lecture Assignment & Lab A6 is not graded yet Done early next wee A7 due Mon, Dec. 4 But extensions possible Just as for one! But mae good effort Lab Today: Office Hours Get elp on A7 paddle Anyone can go to any lab Next Wee Last Wee of Class! Finis sorting algoritms Special final lecture Lab eld, but is optional Unless only ave 10 labs Also use lab time on A7 Details about te exam Multiple review sessions 11/22/16 Sequences (Continued) 2

3 Recall: Horizontal Notation 0 len(b) b <= sorted >= Example of an assertion about an sequence b. It asserts tat: 1. b[0.. 1] is sorted (i.e. its values are in ascending order) 2. Everyting in b[0.. 1] is everyting in b[..len(b) 1] b 0 Given index of te first element of a segment and index of te element tat follows tat segment, te number of values in te segment is. b[.. 1] as elements in it. +1 (+1) = 1 11/22/16 Sequences (Continued) 3

4 Partition Algoritm Given a sequence b[..] wit some value x in b[]: pre: b x? Swap elements of b[..] and store in j to trutify post: i i+1 post: b <= x x >= x inv: b i j <= x x? >= x Agrees wit precondition wen i =, j = +1 Agrees wit postcondition wen j = i+1 11/22/16 Sequences (Continued) 4

5 Partition Algoritm Implementation def partition(b,, ): """Partition list b[..] around a pivot x = b[]""" i = ; j = +1; x = b[] # invariant: b[..i-1] < x, b[i] = x, b[j..] >= x wile i < j-1: if b[i+1] >= x: # Move to end of bloc. swap(b,i+1,j-1) j = j - 1 else: # b[i+1] < x swap(b,i,i+1) i = i + 1 # post: b[..i-1] < x, b[i] is x, and b[i+1..] >= x return i partition(b,,), not partition(b[:+1]) Remember, slicing always copies te list! We want to partition te original list 11/22/16 Sequences (Continued) 5

6 Partition Algoritm Implementation def partition(b,, ): """Partition list b[..] around a pivot x = b[]""" i = ; j = +1; x = b[] # invariant: b[..i-1] < x, b[i] = x, b[j..] >= x wile i < j-1: if b[i+1] >= x: # Move to end of bloc. swap(b,i+1,j-1) j = j - 1 else: # b[i+1] < x swap(b,i,i+1) i = i + 1 # post: b[..i-1] < x, b[i] is x, and b[i+1..] >= x return i <= x x? >= x i i+1 j /22/16 Sequences (Continued) 6

7 Partition Algoritm Implementation def partition(b,, ): """Partition list b[..] around a pivot x = b[]""" i = ; j = +1; x = b[] # invariant: b[..i-1] < x, b[i] = x, b[j..] >= x wile i < j-1: if b[i+1] >= x: # Move to end of bloc. swap(b,i+1,j-1) j = j - 1 else: # b[i+1] < x swap(b,i,i+1) i = i + 1 # post: b[..i-1] < x, b[i] is x, and b[i+1..] >= x return i <= x x? >= x i i+1 j i i+1 j /22/16 Sequences (Continued) 7

8 Partition Algoritm Implementation def partition(b,, ): """Partition list b[..] around a pivot x = b[]""" i = ; j = +1; x = b[] # invariant: b[..i-1] < x, b[i] = x, b[j..] >= x wile i < j-1: if b[i+1] >= x: # Move to end of bloc. swap(b,i+1,j-1) j = j - 1 else: # b[i+1] < x swap(b,i,i+1) i = i + 1 # post: b[..i-1] < x, b[i] is x, and b[i+1..] >= x return i <= x x? >= x i i+1 j i i+1 j i j /22/16 Sequences (Continued) 8

9 Partition Algoritm Implementation def partition(b,, ): """Partition list b[..] around a pivot x = b[]""" i = ; j = +1; x = b[] # invariant: b[..i-1] < x, b[i] = x, b[j..] >= x wile i < j-1: if b[i+1] >= x: # Move to end of bloc. swap(b,i+1,j-1) j = j - 1 else: # b[i+1] < x swap(b,i,i+1) i = i + 1 # post: b[..i-1] < x, b[i] is x, and b[i+1..] >= x return i <= x x? >= x i i+1 j i i+1 j i j i j /22/16 Sequences (Continued) 9

10 Dutc National Flag Variant Sequence of integer values red = negatives, wite = 0, blues = positive Only rearrange part of te list, not all pre: b post: b? < 0 = 0 > 0 t i j inv: b < 0? = 0 > 0 11/22/16 Sequences (Continued) 10

11 Dutc National Flag Variant Sequence of integer values red = negatives, wite = 0, blues = positive Only rearrange part of te list, not all pre: b? post: b < 0 = 0 > 0 t i j inv: b < 0? = 0 > 0 pre: t =, i = +1, j = post: t = i 11/22/16 Sequences (Continued) 11

12 Dutc National Flag Algoritm def dnf(b,, ): """Returns: partition points as a tuple (i,j)""" t = ; i = +1, j = ; # inv: b[..t-1] < 0, b[t..i-1]?, b[i..j] = 0, b[j+1..] > 0 wile t < i: if b[i-1] < 0: swap(b,i-1,t) t = t+1 elif b[i-1] == 0: else: i = i-1 swap(b,i-1,j) i = i-1; j = j-1 # post: b[..i-1] < 0, b[i..j] = 0, b[j+1..] > 0 return (i, j) < 0? = 0 > 0 t i j /22/16 Sequences (Continued) 12

13 Dutc National Flag Algoritm def dnf(b,, ): """Returns: partition points as a tuple (i,j)""" t = ; i = +1, j = ; # inv: b[..t-1] < 0, b[t..i-1]?, b[i..j] = 0, b[j+1..] > 0 wile t < i: if b[i-1] < 0: swap(b,i-1,t) t = t+1 elif b[i-1] == 0: else: i = i-1 swap(b,i-1,j) i = i-1; j = j-1 # post: b[..i-1] < 0, b[i..j] = 0, b[j+1..] > 0 return (i, j) < 0? = 0 > 0 t i j t i j /22/16 Sequences (Continued) 13

14 Dutc National Flag Algoritm def dnf(b,, ): """Returns: partition points as a tuple (i,j)""" t = ; i = +1, j = ; # inv: b[..t-1] < 0, b[t..i-1]?, b[i..j] = 0, b[j+1..] > 0 wile t < i: if b[i-1] < 0: swap(b,i-1,t) t = t+1 elif b[i-1] == 0: else: i = i-1 swap(b,i-1,j) i = i-1; j = j-1 # post: b[..i-1] < 0, b[i..j] = 0, b[j+1..] > 0 return (i, j) < 0? = 0 > 0 t i j t i j t i j /22/16 Sequences (Continued) 14

15 Dutc National Flag Algoritm def dnf(b,, ): """Returns: partition points as a tuple (i,j)""" t = ; i = +1, j = ; # inv: b[..t-1] < 0, b[t..i-1]?, b[i..j] = 0, b[j+1..] > 0 wile t < i: if b[i-1] < 0: swap(b,i-1,t) t = t+1 elif b[i-1] == 0: else: i = i-1 swap(b,i-1,j) i = i-1; j = j-1 # post: b[..i-1] < 0, b[i..j] = 0, b[j+1..] > 0 return (i, j) < 0? = 0 > 0 t i j t i j t i j t j /22/16 Sequences (Continued) 15

16 Now we ave four colors! Flag of Mauritius Negatives: red = odd, purple = even Positives: yellow = odd, green = even pre: b? post: b inv: b < 0 odd < 0 even 0 odd 0 even r s i t < 0, o < 0, e 0, o? 0, e 11/22/16 Sequences (Continued) 16

17 Flag of Mauritius < 0, o < 0, e 0, o? 0, e r s i t r s i t One swap is not good enoug 11/22/16 Sequences (Continued) 17

18 Flag of Mauritius < 0, o < 0, e 0, o? 0, e r s i t r s i t Need two swaps for two spaces 11/22/16 Sequences (Continued) 18

19 Flag of Mauritius < 0, o < 0, e 0, o? 0, e r s i t r s i t And adjust te loop variables 11/22/16 Sequences (Continued) 19

20 Flag of Mauritius < 0, o < 0, e 0, o? 0, e r s i t r s i t See algoritms.py for Pyton code r s i t /22/16 Sequences (Continued) 20

21 Flag of Mauritius < 0, o < 0, e 0, o? 0, e r s i t r s i t See algoritms.py for Pyton code r s i t r s i t /22/16 Sequences (Continued) 21

22 Linear Searc Vague: Find first occurrence of v in b[..-1]. 11/22/16 Sequences (Continued) 22

23 Linear Searc Vague: Find first occurrence of v in b[..-1]. Better: Store an integer in i to trutify result condition post: post: 1. v is not in b[..i-1] 2. i = OR v = b[i] 11/22/16 Sequences (Continued) 23

24 Linear Searc Vague: Find first occurrence of v in b[..-1]. Better: Store an integer in i to trutify result condition post: post: 1. v is not in b[..i-1] 2. i = OR v = b[i] pre: b? post: b i v not ere v? 11/22/16 Sequences (Continued) 24

25 Linear Searc Vague: Find first occurrence of v in b[..-1]. Better: Store an integer in i to trutify result condition post: post: 1. v is not in b[..i-1] 2. i = OR v = b[i] pre: b? post: b i v not ere v? OR b v not ere i 11/22/16 Sequences (Continued) 25

26 pre: b Linear Searc? post: b i v not ere v? OR b v not ere i inv: b i v not ere? 11/22/16 Sequences (Continued) 26

27 Linear Searc def linear_searc(b,v,,): """Returns: first occurrence of v in b[..-1]""" # Store in i index of te first v in b[..-1] 1. Does te initialization mae inv true? i = # invariant: v is not in b[0..i-1] wile i < and b[i]!= v: i = i + 1 # post: v is not in b[..i-1] # i >= or b[i] == v return i if i < else -1 Analyzing te Loop 2. Is post true wen inv is true and condition is false? 3. Does te repetend mae progress? 4. Does te repetend eep te invariant inv true? 11/22/16 Sequences (Continued) 27

28 Binary Searc Vague: Loo for v in sorted sequence segment b[..]. 11/22/16 Sequences (Continued) 28

29 Binary Searc Vague: Loo for v in sorted sequence segment b[..]. Better: Precondition: b[..-1] is sorted (in ascending order). Postcondition: b[..i] <= v and v < b[i+1..-1] Below, te array is in non-descending order: pre: b? post: b i <= v > v 11/22/16 Sequences (Continued) 29

30 Binary Searc Vague: Loo for v in sorted sequence segment b[..]. Better: Precondition: b[..-1] is sorted (in ascending order). Postcondition: b[..i] <= v and v < b[i+1..-1] Below, te array is in non-descending order: pre: b post: b inv: b <= v? i > v i j < v? > v Called binary searc because eac iteration of te loop cuts te array segment still to be processed in alf 11/22/16 Sequences (Continued) 30

31 Extras Not Covered in Class 11/22/16 Sequences (Continued) 31

32 Loaded Dice Sequence p of lengt n represents n-sided die Contents of p sum to 1 p[] is probability die rolls te number weigted d6, favoring 5, 6 Goal: Want to roll te die Generate random number r between 0 and 1 Pic p[i] suc tat p[i-1] < r p[i] /22/16 Sequences (Continued) 32

33 Loaded Dice Want: Value i suc tat p[i-1] < r <= p[i] pre: b post: b 0 n? 0 i n r > sum r <= sum 0 i n inv: b r > sum? Same as precondition if i = 0 Postcondition is invariant + false loop condition 11/22/16 Sequences (Continued) 33

34 Loaded Dice def roll(p): """Returns: randint in 0..len(p)-1; i returned wit prob. p[i] Precondition: p list of positive floats tat sum to 1.""" r = random.random() # r in [0,1) # Tin of interval [0,1] divided into segments of size p[i] # Store into i te segment number in wic r falls. i = 0; sum_of = p[0] # inv: r >= sum of p[0].. p[i 1]; pend = sum of p[0].. p[i] wile r >= sum_of: sum_of = sum_of + p[i+1] i = i + 1 # post: sum of p[0].. p[i 1] <= r < sum of p[0].. p[i] return i r < sum Analyzing te Loop 1. Does te initialization mae inv true? 2. Is post true wen inv is true and condition is false? 3. Does te repetend mae progress? 4. Does te repetend eep inv true? 0 r is not ere p[0] p[1] p[i] pend p[n 1] inv 1 11/22/16 Sequences (Continued) 34 0 p[0] p[1] p[i] r p[n 1] post 1

35 Reversing a Sequence pre: b not reversed post: b reversed cange: b into b i j inv: b swapped not reversed swapped 11/22/16 Sequences (Continued) 35

Practice Exam 1. Use the limit laws from class compute the following limit. Show all your work and cite all rules used explicitly. xf(x) + 5x.

Practice Exam 1. Use the limit laws from class compute the following limit. Show all your work and cite all rules used explicitly. xf(x) + 5x. Practice Exam 1 Tese problems are meant to approximate wat Exam 1 will be like. You can expect tat problems on te exam will be of similar difficulty. Te actual exam will ave problems from sections 11.1

More information

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Splay Trees Date: 9/27/16

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Splay Trees Date: 9/27/16 600.463 Introduction to lgoritms / lgoritms I Lecturer: Micael initz Topic: Splay Trees ate: 9/27/16 8.1 Introduction Today we re going to talk even more about binary searc trees. -trees, red-black trees,

More information

Binary Search Tree and AVL Trees. Binary Search Tree. Binary Search Tree. Binary Search Tree. Techniques: How does the BST works?

Binary Search Tree and AVL Trees. Binary Search Tree. Binary Search Tree. Binary Search Tree. Techniques: How does the BST works? Binary Searc Tree and AVL Trees Binary Searc Tree A commonly-used data structure for storing and retrieving records in main memory PUC-Rio Eduardo S. Laber Binary Searc Tree Binary Searc Tree A commonly-used

More information

Complex Survey Sample Design in IRS' Multi-objective Taxpayer Compliance Burden Studies

Complex Survey Sample Design in IRS' Multi-objective Taxpayer Compliance Burden Studies Complex Survey Sample Design in IRS' Multi-objective Taxpayer Compliance Burden Studies Jon Guyton Wei Liu Micael Sebastiani Internal Revenue Service, Office of Researc, Analysis & Statistics 1111 Constitution

More information

Figure 11. difference in the y-values difference in the x-values

Figure 11. difference in the y-values difference in the x-values 1. Numerical differentiation Tis Section deals wit ways of numerically approximating derivatives of functions. One reason for dealing wit tis now is tat we will use it briefly in te next Section. But as

More information

In the following I do the whole derivative in one step, but you are welcome to split it up into multiple steps. 3x + 3h 5x 2 10xh 5h 2 3x + 5x 2

In the following I do the whole derivative in one step, but you are welcome to split it up into multiple steps. 3x + 3h 5x 2 10xh 5h 2 3x + 5x 2 Mat 160 - Assignment 3 Solutions - Summer 2012 - BSU - Jaimos F Skriletz 1 1. Limit Definition of te Derivative f( + ) f() Use te limit definition of te derivative, lim, to find te derivatives of te following

More information

Making Informed Rollover Decisions

Making Informed Rollover Decisions Making Informed Rollover Decisions WHAT TO DO WITH YOUR EMPLOYER-SPONSORED RETIREMENT PLAN ASSETS UNDERSTANDING ROLLOVERS Deciding wat to do wit qualified retirement plan assets could be one of te most

More information

2.15 Province of Newfoundland and Labrador Pooled Pension Fund

2.15 Province of Newfoundland and Labrador Pooled Pension Fund Introduction Te Province of Newfoundland and Labrador sponsors defined benefit pension plans for its full-time employees and tose of its agencies, boards and commissions, and for members of its Legislature.

More information

ACC 471 Practice Problem Set # 4 Fall Suggested Solutions

ACC 471 Practice Problem Set # 4 Fall Suggested Solutions ACC 471 Practice Problem Set # 4 Fall 2002 Suggested Solutions 1. Text Problems: 17-3 a. From put-call parity, C P S 0 X 1 r T f 4 50 50 1 10 1 4 $5 18. b. Sell a straddle, i.e. sell a call and a put to

More information

Section 3.1 Distributions of Random Variables

Section 3.1 Distributions of Random Variables Section 3.1 Distributions of Random Variables Random Variable A random variable is a rule that assigns a number to each outcome of a chance experiment. There are three types of random variables: 1. Finite

More information

PRICE INDEX AGGREGATION: PLUTOCRATIC WEIGHTS, DEMOCRATIC WEIGHTS, AND VALUE JUDGMENTS

PRICE INDEX AGGREGATION: PLUTOCRATIC WEIGHTS, DEMOCRATIC WEIGHTS, AND VALUE JUDGMENTS Revised June 10, 2003 PRICE INDEX AGGREGATION: PLUTOCRATIC WEIGHTS, DEMOCRATIC WEIGHTS, AND VALUE JUDGMENTS Franklin M. Fiser Jane Berkowitz Carlton and Dennis William Carlton Professor of Economics Massacusetts

More information

What are Swaps? Spring Stephen Sapp ISFP. Stephen Sapp

What are Swaps? Spring Stephen Sapp ISFP. Stephen Sapp Wat are Swaps? Spring 2013 Basic Idea of Swaps I ave signed up for te Wine of te Mont Club and you ave signed up for te Beer of te Mont Club. As winter approaces, I would like to ave beer but you would

More information

Section 8.1 Distributions of Random Variables

Section 8.1 Distributions of Random Variables Section 8.1 Distributions of Random Variables Random Variable A random variable is a rule that assigns a number to each outcome of a chance experiment. There are three types of random variables: 1. Finite

More information

Calculus I Homework: Four Ways to Represent a Function Page 1. where h 0 and f(x) = x x 2.

Calculus I Homework: Four Ways to Represent a Function Page 1. where h 0 and f(x) = x x 2. Calculus I Homework: Four Ways to Represent a Function Page 1 Questions Example Find f(2 + ), f(x + ), and f(x + ) f(x) were 0 and f(x) = x x 2. Example Find te domain and sketc te grap of te function

More information

DATABASE-ASSISTED spectrum sharing is a promising

DATABASE-ASSISTED spectrum sharing is a promising 1 Optimal Pricing and Admission Control for Heterogeneous Secondary Users Cangkun Jiang, Student Member, IEEE, Lingjie Duan, Member, IEEE, and Jianwei Huang, Fellow, IEEE Abstract Tis paper studies ow

More information

2017 Year-End Retirement Action Plan

2017 Year-End Retirement Action Plan 2017 Year-End Retirement Action Plan Te end of te year is a good time to assess your overall financial picture, especially your retirement strategy. As te year comes to a close, use tis action plan to

More information

Supplemantary material to: Leverage causes fat tails and clustered volatility

Supplemantary material to: Leverage causes fat tails and clustered volatility Supplemantary material to: Leverage causes fat tails and clustered volatility Stefan Turner a,b J. Doyne Farmer b,c Jon Geanakoplos d,b a Complex Systems Researc Group, Medical University of Vienna, Wäringer

More information

The study guide does not look exactly like the exam but it will help you to focus your study efforts.

The study guide does not look exactly like the exam but it will help you to focus your study efforts. Mat 0 Eam Study Guide Solutions Te study guide does not look eactly like te eam but it will elp you to focus your study efforts. Here is part of te list of items under How to Succeed in Mat 0 tat is on

More information

Buildings and Properties

Buildings and Properties Introduction Figure 1 Te Department of Transportation and Works (formerly te Department of Works, Services and Transportation) is responsible for managing and maintaining approximately 650,000 square metres

More information

What are Swaps? Basic Idea of Swaps. What are Swaps? Advanced Corporate Finance

What are Swaps? Basic Idea of Swaps. What are Swaps? Advanced Corporate Finance Wat are Swaps? Spring 2008 Basic Idea of Swaps A swap is a mutually beneficial excange of cas flows associated wit a financial asset or liability. Firm A gives Firm B te obligation or rigts to someting

More information

A Guide to Mutual Fund Investing

A Guide to Mutual Fund Investing AS OF DECEMBER 2016 A Guide to Mutual Fund Investing Many investors turn to mutual funds to meet teir long-term financial goals. Tey offer te benefits of diversification and professional management and

More information

Problem Solving Day: Geometry, movement, and Free-fall. Test schedule SOH CAH TOA! For right triangles. Last year s equation sheet included with exam.

Problem Solving Day: Geometry, movement, and Free-fall. Test schedule SOH CAH TOA! For right triangles. Last year s equation sheet included with exam. Problem Solving Day: Geometry, movement, and Free-fall. Test scedule First mid-term in 2 weeks! 7-10PM; Feb 8, Eiesland Hall. Review and practice a little eac day!!! EMAIL ME THIS WEEK if you ave class

More information

Raising Capital in Global Financial Markets

Raising Capital in Global Financial Markets Raising Capital in Global Financial Markets Fall 2009 Introduction Capital markets facilitate te issuance and subsequent trade of financial securities. Te financial securities are generally stock and bonds

More information

Raising Capital in Global Financial Markets

Raising Capital in Global Financial Markets Raising Capital in Global Financial Markets Fall 2010 Introduction Capital markets facilitate te issuance and subsequent trade of financial securities. Te financial securities are generally stock and bonds

More information

Raising Capital in Global Financial Markets

Raising Capital in Global Financial Markets Raising Capital in Global Financial Markets Fall 2011 Introduction Capital markets facilitate te issuance and subsequent trade of financial securities. Te financial securities are generally stock and bonds

More information

2.21 The Medical Care Plan Beneficiary Registration System. Introduction

2.21 The Medical Care Plan Beneficiary Registration System. Introduction 2.21 Te Medical Care Plan Beneficiary Registration System Introduction Te Newfoundland Medical Care Plan (MCP) was introduced in Newfoundland and Labrador on 1 April 1969. It is a plan of medical care

More information

Sublinear Time Algorithms Oct 19, Lecture 1

Sublinear Time Algorithms Oct 19, Lecture 1 0368.416701 Sublinear Time Algorithms Oct 19, 2009 Lecturer: Ronitt Rubinfeld Lecture 1 Scribe: Daniel Shahaf 1 Sublinear-time algorithms: motivation Twenty years ago, there was practically no investigation

More information

SAT Practice Test #1 IMPORTANT REMINDERS. A No. 2 pencil is required for the test. Do not use a mechanical pencil or pen.

SAT Practice Test #1 IMPORTANT REMINDERS. A No. 2 pencil is required for the test. Do not use a mechanical pencil or pen. SAT Practice Test # IMPORTAT REMIDERS A o. pencil is required for te test. Do not use a mecanical pencil or pen. Saring any questions wit anyone is a violation of Test Security and Fairness policies and

More information

Introduction. Valuation of Assets. Capital Budgeting in Global Markets

Introduction. Valuation of Assets. Capital Budgeting in Global Markets Capital Budgeting in Global Markets Spring 2008 Introduction Capital markets and investment opportunities ave become increasingly global over te past 25 years. As firms (and individuals) are increasingly

More information

Lecture 14: Examples of Martingales and Azuma s Inequality. Concentration

Lecture 14: Examples of Martingales and Azuma s Inequality. Concentration Lecture 14: Examples of Martingales and Azuma s Inequality A Short Summary of Bounds I Chernoff (First Bound). Let X be a random variable over {0, 1} such that P [X = 1] = p and P [X = 0] = 1 p. n P X

More information

The following content is provided under a Creative Commons license. Your support

The following content is provided under a Creative Commons license. Your support MITOCW Recitation 6 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make

More information

Learning Goals: * Determining the expected value from a probability distribution. * Applying the expected value formula to solve problems.

Learning Goals: * Determining the expected value from a probability distribution. * Applying the expected value formula to solve problems. Learning Goals: * Determining the expected value from a probability distribution. * Applying the expected value formula to solve problems. The following are marks from assignments and tests in a math class.

More information

EXAMINATIONS OF THE HONG KONG STATISTICAL SOCIETY

EXAMINATIONS OF THE HONG KONG STATISTICAL SOCIETY EXAMINATIONS OF THE HONG KONG STATISTICAL SOCIETY HIGHER CERTIFICATE IN STATISTICS, 2012 MODULE 8 : Survey sampling and estimation Time allowed: One and a alf ours Candidates sould answer THREE questions.

More information

Maximizing the Sharpe Ratio and Information Ratio in the Barra Optimizer

Maximizing the Sharpe Ratio and Information Ratio in the Barra Optimizer www.mscibarra.com Maximizing te Sarpe Ratio and Information Ratio in te Barra Optimizer June 5, 2009 Leonid Kopman Scott Liu 2009 MSCI Barra. All rigts reserved. of 4 Maximizing te Sarpe Ratio ABLE OF

More information

Raising Capital in Global Financial Markets

Raising Capital in Global Financial Markets Raising Capital in Global Financial Markets Spring 2012 Wat are Capital Markets? Capital markets facilitate te issuance and subsequent trade of financial securities. Te financial securities are generally

More information

Section 8.1 Distributions of Random Variables

Section 8.1 Distributions of Random Variables Section 8.1 Distributions of Random Variables Random Variable A random variable is a rule that assigns a number to each outcome of a chance experiment. There are three types of random variables: 1. Finite

More information

We have learned that. Marke+ng Investment and Financial Hurdle Rates. Rates of Return Are Different 10/1/15

We have learned that. Marke+ng Investment and Financial Hurdle Rates. Rates of Return Are Different 10/1/15 We ave learned tat Markeng Investment and Financial Hurdle Rates Profit Funcons associated wit Financial Investments and Profit Funcons associated wit Markeng Investments are totally different in caracter

More information

Chapter 8. Introduction to Endogenous Policy Theory. In this chapter we begin our development of endogenous policy theory: the explicit

Chapter 8. Introduction to Endogenous Policy Theory. In this chapter we begin our development of endogenous policy theory: the explicit Capter 8 Introduction to Endogenous Policy Teory In tis capter we begin our development of endogenous policy teory: te explicit incorporation of a model of politics in a model of te economy, permitting

More information

SHORT ANSWER. Write the word or phrase that best completes each statement or answers the question.

SHORT ANSWER. Write the word or phrase that best completes each statement or answers the question. Math 131-03 Practice Questions for Exam# 2 SHORT ANSWER. Write the word or phrase that best completes each statement or answers the question. 1) What is the effective rate that corresponds to a nominal

More information

Confidence Intervals for the Median and Other Percentiles

Confidence Intervals for the Median and Other Percentiles Confidence Intervals for the Median and Other Percentiles Authored by: Sarah Burke, Ph.D. 12 December 2016 Revised 22 October 2018 The goal of the STAT COE is to assist in developing rigorous, defensible

More information

Experimental Probability - probability measured by performing an experiment for a number of n trials and recording the number of outcomes

Experimental Probability - probability measured by performing an experiment for a number of n trials and recording the number of outcomes MDM 4U Probability Review Properties of Probability Experimental Probability - probability measured by performing an experiment for a number of n trials and recording the number of outcomes Theoretical

More information

Technical indicators

Technical indicators Technical indicators Trend indicators Momentum indicators Indicators based on volume Indicators measuring volatility Ichimoku indicator Divergences When the price movement and the indicator s movement

More information

{INCLUDES 2 VERSIONS!} FACTORING TRINOMIALS COLORING ACTIVITY ALL THINGS ALGEBRA. Created by:

{INCLUDES 2 VERSIONS!} FACTORING TRINOMIALS COLORING ACTIVITY ALL THINGS ALGEBRA. Created by: {INCLUDES VERSIONS!} FACTORING TRINOMIALS COLORING ACTIVITY Created by: ALL THINGS ALGEBRA FACTORING TRINOMIALS Coloring Activity! Name: Date: Per: Directions: Factor each trinomial. Identify the binomial

More information

Applying Alternative Variance Estimation Methods for Totals Under Raking in SOI s Corporate Sample

Applying Alternative Variance Estimation Methods for Totals Under Raking in SOI s Corporate Sample Applying Alternative Variance Estimation Metods for Totals Under Raking in SOI s Corporate Sample Kimberly Henry 1, Valerie Testa 1, and Ricard Valliant 2 1 Statistics of Income, P.O. Box 2608, Wasngton

More information

11.1 Average Rate of Change

11.1 Average Rate of Change 11.1 Average Rate of Cange Question 1: How do you calculate te average rate of cange from a table? Question : How do you calculate te average rate of cange from a function? In tis section, we ll examine

More information

Practice Second Midterm Exam II

Practice Second Midterm Exam II CS13 Handout 34 Fall 218 November 2, 218 Practice Second Midterm Exam II This exam is closed-book and closed-computer. You may have a double-sided, 8.5 11 sheet of notes with you when you take this exam.

More information

Price indeterminacy in day-ahead market

Price indeterminacy in day-ahead market Price indeterminacy in day-aead market Mid-Price rule A "price indeterminacy" is a situation in wic at least two feasible solutions wit te same matced volume, te same block and MIC selections and te same

More information

Iteration. The Cake Eating Problem. Discount Factors

Iteration. The Cake Eating Problem. Discount Factors 18 Value Function Iteration Lab Objective: Many questions have optimal answers that change over time. Sequential decision making problems are among this classification. In this lab you we learn how to

More information

2.17 Tax Expenditures. Introduction. Scope and Objectives

2.17 Tax Expenditures. Introduction. Scope and Objectives Introduction Programs offered by te Province are normally outlined in te Estimates and approved by te Members of te House of Assembly as part of te annual budgetary approval process. However, te Province

More information

Math 180A. Lecture 5 Wednesday April 7 th. Geometric distribution. The geometric distribution function is

Math 180A. Lecture 5 Wednesday April 7 th. Geometric distribution. The geometric distribution function is Geometric distribution The geometric distribution function is x f ( x) p(1 p) 1 x {1,2,3,...}, 0 p 1 It is the pdf of the random variable X, which equals the smallest positive integer x such that in a

More information

Notes 12 : Kesten-Stigum bound

Notes 12 : Kesten-Stigum bound Notes : Kesten-Stigum bound MATH 833 - Fall 0 Lecturer: Sebastien Roc References: [EKPS00, Mos0, MP03, BCMR06]. Kesten-Stigum bound Te previous teorem was proved by sowing tat majority is a good root estimator

More information

Chapter 4 Rates of Change

Chapter 4 Rates of Change Capter 4 Rates of Cange In tis capter we will investigate ow fast one quantity canges in relation to anoter. Te first type of cange we investigate is te average rate of cange, or te rate a quantity canges

More information

CSCE 750, Fall 2009 Quizzes with Answers

CSCE 750, Fall 2009 Quizzes with Answers CSCE 750, Fall 009 Quizzes with Answers Stephen A. Fenner September 4, 011 1. Give an exact closed form for Simplify your answer as much as possible. k 3 k+1. We reduce the expression to a form we ve already

More information

South Korea s Trade Intensity With ASEAN Countries and Its Changes Over Time*

South Korea s Trade Intensity With ASEAN Countries and Its Changes Over Time* International Review of Business Researc Papers Vol. 8. No.4. May 2012. Pp. 63 79 Sout Korea s Trade Intensity Wit ASEAN Countries and Its Canges Over Time* Seung Jin Kim** Tis paper analyzes ow Korea

More information

Name: Date: Pd: Quiz Review

Name: Date: Pd: Quiz Review Name: Date: Pd: Quiz Review 8.1-8.3 Multiple Choice Identify the choice that best completes the statement or answers the question. 1. A die is cast repeatedly until a 1 falls uppermost. Let the random

More information

Probability and Sample space

Probability and Sample space Probability and Sample space We call a phenomenon random if individual outcomes are uncertain but there is a regular distribution of outcomes in a large number of repetitions. The probability of any outcome

More information

AP Statistics Chapter 6 - Random Variables

AP Statistics Chapter 6 - Random Variables AP Statistics Chapter 6 - Random 6.1 Discrete and Continuous Random Objective: Recognize and define discrete random variables, and construct a probability distribution table and a probability histogram

More information

MAS115: R programming Lecture 3: Some more pseudo-code and Monte Carlo estimation Lab Class: for and if statements, input

MAS115: R programming Lecture 3: Some more pseudo-code and Monte Carlo estimation Lab Class: for and if statements, input MAS115: R programming Lecture 3: Some more pseudo-code and Monte Carlo estimation Lab Class: for and if statements, input The University of Sheffield School of Mathematics and Statistics Aims Introduce

More information

Homework #4. CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class

Homework #4. CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class Homework #4 CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class o Grades depend on neatness and clarity. o Write your answers with enough detail about your approach and concepts

More information

Data Structures and Algorithms February 10, 2007 Pennsylvania State University CSE 465 Professors Sofya Raskhodnikova & Adam Smith Handout 10

Data Structures and Algorithms February 10, 2007 Pennsylvania State University CSE 465 Professors Sofya Raskhodnikova & Adam Smith Handout 10 Data Structures and Algorithms February 10, 2007 Pennsylvania State University CSE 465 Professors Sofya Raskhodnikova & Adam Smith Handout 10 Practice Exam 1 Do not open this exam booklet until you are

More information

Engineering and Information Services BENEFITS ENROLLMENT

Engineering and Information Services BENEFITS ENROLLMENT Engineering and Information Services 2018 BENEFITS ENROLLMENT Welcome to 2018 Open Enrollment We are pleased to continue to offer eligible employees and teir dependents a robust benefits program for 2018.

More information

NMAI059 Probability and Statistics Exercise assignments and supplementary examples October 21, 2017

NMAI059 Probability and Statistics Exercise assignments and supplementary examples October 21, 2017 NMAI059 Probability and Statistics Exercise assignments and supplementary examples October 21, 2017 How to use this guide. This guide is a gradually produced text that will contain key exercises to practise

More information

Exercise 1: Robinson Crusoe who is marooned on an island in the South Pacific. He can grow bananas and coconuts. If he uses

Exercise 1: Robinson Crusoe who is marooned on an island in the South Pacific. He can grow bananas and coconuts. If he uses Jon Riley F Maimization wit a single constraint F5 Eercises Eercise : Roinson Crusoe wo is marooned on an isl in te Sout Pacific He can grow ananas coconuts If e uses z acres to produce ananas z acres

More information

The Binomial Distribution

The Binomial Distribution MATH 382 The Binomial Distribution Dr. Neal, WKU Suppose there is a fixed probability p of having an occurrence (or success ) on any single attempt, and a sequence of n independent attempts is made. Then

More information

Number of Municipalities. Funding (Millions) $ April 2003 to July 2003

Number of Municipalities. Funding (Millions) $ April 2003 to July 2003 Introduction Te Department of Municipal and Provincial Affairs is responsible for matters relating to local government, municipal financing, urban and rural planning, development and engineering, and coordination

More information

VARIANCE-BASED SAMPLING FOR CYCLE TIME - THROUGHPUT CONFIDENCE INTERVALS. Rachel T. Johnson Sonia E. Leach John W. Fowler Gerald T.

VARIANCE-BASED SAMPLING FOR CYCLE TIME - THROUGHPUT CONFIDENCE INTERVALS. Rachel T. Johnson Sonia E. Leach John W. Fowler Gerald T. Proceedings of te 004 Winter Simulation Conference R.G. Ingalls, M. D. Rossetti, J.S. Smit, and B.A. Peters, eds. VARIANCE-BASED SAMPLING FOR CYCLE TIME - THROUGHPUT CONFIDENCE INTERVALS Racel T. Jonson

More information

Chance/Rossman ISCAM II Chapter 0 Exercises Last updated August 28, 2014 ISCAM 2: CHAPTER 0 EXERCISES

Chance/Rossman ISCAM II Chapter 0 Exercises Last updated August 28, 2014 ISCAM 2: CHAPTER 0 EXERCISES ISCAM 2: CHAPTER 0 EXERCISES 1. Random Ice Cream Prices Suppose that an ice cream shop offers a special deal one day: The price of a small ice cream cone will be determined by rolling a pair of ordinary,

More information

Taxes and Entry Mode Decision in Multinationals: Export and FDI with and without Decentralization

Taxes and Entry Mode Decision in Multinationals: Export and FDI with and without Decentralization Taxes and Entry Mode Decision in Multinationals: Export and FDI wit and witout Decentralization Yosimasa Komoriya y Cuo University Søren Bo Nielsen z Copenagen Business Scool Pascalis Raimondos z Copenagen

More information

Chapter 4. Probability Lecture 1 Sections: Fundamentals of Probability

Chapter 4. Probability Lecture 1 Sections: Fundamentals of Probability Chapter 4 Probability Lecture 1 Sections: 4.1 4.2 Fundamentals of Probability In discussing probabilities, we must take into consideration three things. Event: Any result or outcome from a procedure or

More information

Discrete Mathematics for CS Spring 2008 David Wagner Final Exam

Discrete Mathematics for CS Spring 2008 David Wagner Final Exam CS 70 Discrete Mathematics for CS Spring 2008 David Wagner Final Exam PRINT your name:, (last) SIGN your name: (first) PRINT your Unix account login: Your section time (e.g., Tue 3pm): Name of the person

More information

Basic Data Analysis. Stephen Turnbull Business Administration and Public Policy Lecture 4: May 2, Abstract

Basic Data Analysis. Stephen Turnbull Business Administration and Public Policy Lecture 4: May 2, Abstract Basic Data Analysis Stephen Turnbull Business Administration and Public Policy Lecture 4: May 2, 2013 Abstract Introduct the normal distribution. Introduce basic notions of uncertainty, probability, events,

More information

Liquidity Shocks and Optimal Monetary and Exchange Rate Policies in a Small Open Economy?

Liquidity Shocks and Optimal Monetary and Exchange Rate Policies in a Small Open Economy? TBA manuscript No. (will be inserted by te editor) Liquidity Socks and Optimal Monetary and Excange Rate Policies in a Small Open Economy? Joydeep Battacarya, Rajes Sing 2 Iowa State University; e-mail:

More information

2 all subsequent nodes. 252 all subsequent nodes. 401 all subsequent nodes. 398 all subsequent nodes. 330 all subsequent nodes

2 all subsequent nodes. 252 all subsequent nodes. 401 all subsequent nodes. 398 all subsequent nodes. 330 all subsequent nodes ¼ À ÈÌ Ê ½¾ ÈÊÇ Ä ÅË ½µ ½¾º¾¹½ ¾µ ½¾º¾¹ µ ½¾º¾¹ µ ½¾º¾¹ µ ½¾º ¹ µ ½¾º ¹ µ ½¾º ¹¾ µ ½¾º ¹ µ ½¾¹¾ ½¼µ ½¾¹ ½ (1) CLR 12.2-1 Based on the structure of the binary tree, and the procedure of Tree-Search, any

More information

Programming Languages

Programming Languages CSE 230: Winter 2010 Principles of Programming Languages Lecture 3: Induction, Equivalence Ranjit Jhala UC San Diego Operational Semantics of IMP Evaluation judgement for commands Ternary relation on expression,

More information

A.REPRESENTATION OF DATA

A.REPRESENTATION OF DATA A.REPRESENTATION OF DATA (a) GRAPHS : PART I Q: Why do we need a graph paper? Ans: You need graph paper to draw: (i) Histogram (ii) Cumulative Frequency Curve (iii) Frequency Polygon (iv) Box-and-Whisker

More information

MA 1125 Lecture 14 - Expected Values. Wednesday, October 4, Objectives: Introduce expected values.

MA 1125 Lecture 14 - Expected Values. Wednesday, October 4, Objectives: Introduce expected values. MA 5 Lecture 4 - Expected Values Wednesday, October 4, 27 Objectives: Introduce expected values.. Means, Variances, and Standard Deviations of Probability Distributions Two classes ago, we computed the

More information

Market shares and multinationals investment: a microeconomic foundation for FDI gravity equations

Market shares and multinationals investment: a microeconomic foundation for FDI gravity equations Market sares and multinationals investment: a microeconomic foundation for FDI gravity equations Gaetano Alfredo Minerva November 22, 2006 Abstract In tis paper I explore te implications of te teoretical

More information

Chapter 16. Binary Search Trees (BSTs)

Chapter 16. Binary Search Trees (BSTs) Chapter 16 Binary Search Trees (BSTs) Search trees are tree-based data structures that can be used to store and search for items that satisfy a total order. There are many types of search trees designed

More information

10 5 The Binomial Theorem

10 5 The Binomial Theorem 10 5 The Binomial Theorem Daily Outcomes: I can use Pascal's triangle to write binomial expansions I can use the Binomial Theorem to write and find the coefficients of specified terms in binomial expansions

More information

Managing and Identifying Risk

Managing and Identifying Risk Managing and Identifying Risk Fall 2011 All of life is te management of risk, not its elimination Risk is te volatility of unexpected outcomes. In te context of financial risk te volatility is in: 1. te

More information

S = 1,2,3, 4,5,6 occurs

S = 1,2,3, 4,5,6 occurs Chapter 5 Discrete Probability Distributions The observations generated by different statistical experiments have the same general type of behavior. Discrete random variables associated with these experiments

More information

INSTITUTE OF ACTUARIES OF INDIA EXAMINATIONS. 20 th May Subject CT3 Probability & Mathematical Statistics

INSTITUTE OF ACTUARIES OF INDIA EXAMINATIONS. 20 th May Subject CT3 Probability & Mathematical Statistics INSTITUTE OF ACTUARIES OF INDIA EXAMINATIONS 20 th May 2013 Subject CT3 Probability & Mathematical Statistics Time allowed: Three Hours (10.00 13.00) Total Marks: 100 INSTRUCTIONS TO THE CANDIDATES 1.

More information

6.1 Binomial Theorem

6.1 Binomial Theorem Unit 6 Probability AFM Valentine 6.1 Binomial Theorem Objective: I will be able to read and evaluate binomial coefficients. I will be able to expand binomials using binomial theorem. Vocabulary Binomial

More information

Optimal inventory model with single item under various demand conditions

Optimal inventory model with single item under various demand conditions Optimal inventory model wit single item under various demand conditions S. Barik, S.K. Paikray, S. Misra 3, Boina nil Kumar 4,. K. Misra 5 Researc Scolar, Department of Matematics, DRIEMS, angi, Cuttack,

More information

COMP-533 Object-Oriented Software Development. Midterm. (30% of final grade) October 19, 2010

COMP-533 Object-Oriented Software Development. Midterm. (30% of final grade) October 19, 2010 COMP-533 Object-Oriented Software Development Midterm (30% of final grade) October 19, 2010 Name: Problem 1: Domain Model, OCL invariants and functions (40%) An insurance company wants to automate its

More information

The Implicit Pipeline Method

The Implicit Pipeline Method Te Implicit Pipeline Metod Jon B. Pormann NSF/ERC for Emerging Cardiovascular Tecnologies Duke University, Duram, NC, 7708-096 Jon A. Board, Jr. Department of Electrical and Computer Engineering Duke University,

More information

Math 160 Professor Busken Chapter 5 Worksheets

Math 160 Professor Busken Chapter 5 Worksheets Math 160 Professor Busken Chapter 5 Worksheets Name: 1. Find the expected value. Suppose you play a Pick 4 Lotto where you pay 50 to select a sequence of four digits, such as 2118. If you select the same

More information

Successor. CS 361, Lecture 19. Tree-Successor. Outline

Successor. CS 361, Lecture 19. Tree-Successor. Outline Successor CS 361, Lecture 19 Jared Saia University of New Mexico The successor of a node x is the node that comes after x in the sorted order determined by an in-order tree walk. If all keys are distinct,

More information

Labor Market Flexibility and Growth.

Labor Market Flexibility and Growth. Labor Market Flexibility and Growt. Enisse Karroubi July 006. Abstract Tis paper studies weter exibility on te labor market contributes to output growt. Under te assumption tat rms and workers face imperfect

More information

Mathematical Statistics İST2011 PROBABILITY THEORY (3) DEU, DEPARTMENT OF STATISTICS MATHEMATICAL STATISTICS SUMMER SEMESTER, 2017.

Mathematical Statistics İST2011 PROBABILITY THEORY (3) DEU, DEPARTMENT OF STATISTICS MATHEMATICAL STATISTICS SUMMER SEMESTER, 2017. Mathematical Statistics İST2011 PROBABILITY THEORY (3) 1 DEU, DEPARTMENT OF STATISTICS MATHEMATICAL STATISTICS SUMMER SEMESTER, 2017 If the five balls are places in five cell at random, find the probability

More information

Managing and Identifying Risk

Managing and Identifying Risk Managing and Identifying Risk Spring 2008 All of life is te management of risk, not its elimination Risk is te volatility of unexpected outcomes. In te context of financial risk it can relate to volatility

More information

The Market for EPL Odds. Guanhao Feng

The Market for EPL Odds. Guanhao Feng The Market for EPL Odds Guanhao Feng Booth School of Business, University of Chicago R/Finance 2017 (Joint work with Nicholas Polson and Jianeng Xu) Motivation Soccermatics from David Sumpter Model Application

More information

a) Give an example of a case when an (s,s) policy is not the same as an (R,Q) policy. (2p)

a) Give an example of a case when an (s,s) policy is not the same as an (R,Q) policy. (2p) roblem a) Give an example of a case wen an (s,s) policy is not te same as an (R,) policy. (p) b) Consider exponential smooting wit te smooting constant α and moving average over N periods. Ten, tese two

More information

Season Audition Packet Cymbals

Season Audition Packet Cymbals 208-209 Season Audition Packet Cymbals Hello All, If you are reading tis, it means you are interested in auditioning for te 208-209 edition of te JMU Marcing Royal Dukes Percussion Section! We ope tat

More information

Probability Distributions

Probability Distributions Chapter 6 Discrete Probability Distributions Section 6-2 Probability Distributions Definitions Let S be the sample space of a probability experiment. A random variable X is a function from the set S into

More information

Probability Distributions: Discrete

Probability Distributions: Discrete Probability Distributions: Discrete Introduction to Data Science Algorithms Jordan Boyd-Graber and Michael Paul SEPTEMBER 27, 2016 Introduction to Data Science Algorithms Boyd-Graber and Paul Probability

More information

Global Financial Markets

Global Financial Markets Global Financial Markets Spring 2013 Wat is a Market? A market is any system, institution, procedure and/or infrastructure tat brings togeter groups of people to trade goods, services and/or information.

More information

SUSTAINABLE ENERGY TECHNOLOGIES AND LOCAL AUTHORITIES: ENERGY SERVICE COMPANY, ENERGY PERFORMANCE CONTRACT, FORFEITING

SUSTAINABLE ENERGY TECHNOLOGIES AND LOCAL AUTHORITIES: ENERGY SERVICE COMPANY, ENERGY PERFORMANCE CONTRACT, FORFEITING SUSTAINABLE ENERGY TECHNOLOGIES AND LOCAL AUTHORITIES: ENERGY SERVICE COMPANY, ENERGY PERFORMANCE CONTRACT, FORFEITING VORONCA M.-M.*, VORONCA S.-L.** *Romanian Energy Efficiency Fund, Joann Strauss no.

More information

International Journal of Pure and Applied Sciences and Technology

International Journal of Pure and Applied Sciences and Technology Int.. Pure Appl. Sci. Tecnol., 17(1) (2013), pp. 60-83 International ournal of Pure and Applied Sciences and Tecnology ISSN 2229-6107 Available online at www.ijopaasat.in Researc Paper Optimal Pricing

More information

The Volatility of Investments

The Volatility of Investments The Volatility of Investments Adapted from STAT 603 (The Wharton School) by Professors Ed George, Abba Krieger, Robert Stine, and Adi Wyner Sathyanarayan Anand STAT 430H/510, Fall 2011 Random Variables

More information