CSE 21 Math for Algorithms and Systems Analysis. Lecture 2 Lists Without Repe>>on

Similar documents
The Product Rule can be viewed as counting the number of elements in the Cartesian product of the finite sets

CSE 21 Math for Algorithms and Systems Analysis. Lecture 4 Mul<nomial Coefficients and Sets

Permutations and Combinations

Exercises Exercises. 1. List all the permutations of {a, b, c}. 2. How many different permutations are there of the set {a, b, c, d, e, f, g}?

Test 3 (Version 1) Fall 2014

Discrete Mathematics with Applications MATH236

Chapter 1. Set Theory

Week 3-4: Permutations and Combinations

Math 365 Wednesday 2/20/19 Section 6.1: Basic counting

Probability Theory. Mohamed I. Riffi. Islamic University of Gaza

Counting. Chapter 6. With Question/Answer Animations

Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1:

Combinatorics problems

Multiple Choice Questions for Review

November 8, Chapter 8: Probability: The Mathematics of Chance

Math 1111 Math Exam Study Guide

Math 1111 Math Exam Study Guide

50 Counting Questions

With Question/Answer Animations. Chapter 6

CPCS 222 Discrete Structures I Counting

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

Counting and Probability Math 2320

Counting: Basics. Four main concepts this week 10/12/2016. Product rule Sum rule Inclusion-exclusion principle Pigeonhole principle

November 6, Chapter 8: Probability: The Mathematics of Chance

Strings. A string is a list of symbols in a particular order.

Exam 2 Review (Sections Covered: 3.1, 3.3, , 7.1) 1. Write a system of linear inequalities that describes the shaded region.

Discrete Structures Lecture Permutations and Combinations

ACTIVITY 6.7 Selecting and Rearranging Things

Elementary Combinatorics

1. For which of the following sets does the mean equal the median?

1. An office building contains 27 floors and has 37 offices on each floor. How many offices are in the building?

Counting Methods and Probability

Math 3012 Applied Combinatorics Lecture 2

In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors?

COUNTING TECHNIQUES. Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen

STATISTICAL COUNTING TECHNIQUES

CSE 21 Mathematics for Algorithm and System Analysis

Permutations and Combinations

Counting in Algorithms

Sec.on Summary. The Product Rule The Sum Rule The Subtraction Rule (Principle of Inclusion- Exclusion)

Unit Nine Precalculus Practice Test Probability & Statistics. Name: Period: Date: NON-CALCULATOR SECTION

Permutations and Combinations

Theory of Probability - Brett Bernstein

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

CSE 21 Math for Algorithms and Systems Analysis. Lecture 7 Func=ons Lecture 2

Mathematical Foundations of Computer Science Lecture Outline August 30, 2018

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

Simple Counting Problems

Cardinality. Hebrew alphabet). We write S = ℵ 0 and say that S has cardinality aleph null.

CSE 1400 Applied Discrete Mathematics Permutations

University of Connecticut Department of Mathematics

Mat 344F challenge set #2 Solutions

MA/CSSE 473 Day 14. Permutations wrap-up. Subset generation. (Horner s method) Permutations wrap up Generating subsets of a set

Discrete mathematics

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

Introductory Probability

Classical vs. Empirical Probability Activity

Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples

CS 237: Probability in Computing

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

November 11, Chapter 8: Probability: The Mathematics of Chance

Chapter 2 Basic Counting

Homework Set #1. 1. The Supreme Court (9 members) meet, and all the justices shake hands with each other. How many handshakes are there?

Section : Combinations and Permutations

With Question/Answer Animations. Chapter 6

Combinatorics. PIE and Binomial Coefficients. Misha Lavrov. ARML Practice 10/20/2013

Outline. Content The basics of counting The pigeonhole principle Reading Chapter 5 IRIS H.-R. JIANG

CSE 312: Foundations of Computing II Quiz Section #1: Counting

CS 237 Fall 2018, Homework SOLUTION

CONTENTS GRAPH THEORY

Probability and Counting Techniques

Unit 5 Radical Functions & Combinatorics

Senior Math Circles February 10, 2010 Game Theory II

The topic for the third and final major portion of the course is Probability. We will aim to make sense of statements such as the following:

Probability: introduction

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability

Solutions for the Practice Final

Chapter 2. Permutations and Combinations

Mutually Exclusive Events

Modeling, Analysis and Optimization of Networks. Alberto Ceselli

Combinatorics and Intuitive Probability

Counting Things. Tom Davis March 17, 2006

6.1 Basics of counting

Counting integral solutions

Probability MAT230. Fall Discrete Mathematics. MAT230 (Discrete Math) Probability Fall / 37

Introduction to Counting and Probability

PLEASE MARK YOUR ANSWERS WITH AN X, not a circle! 2. (a) (b) (c) (d) (e) (a) (b) (c) (d) (e) (a) (b) (c) (d) (e)...

7.1 Experiments, Sample Spaces, and Events

Section The Multiplication Principle and Permutations

4.1 Sample Spaces and Events

2. Combinatorics: the systematic study of counting. The Basic Principle of Counting (BPC)

HOMEWORK ASSIGNMENT 5

Midterm (Sample Version 3, with Solutions)

Brian Diamond. New Minimum Number of Clues Findings to Sudoku- deriva;ve Games up to 5- by- 5 Matrices. including

A complete set of dominoes containing the numbers 0, 1, 2, 3, 4, 5 and 6, part of which is shown, has a total of 28 dominoes.

Unit 1 Day 1: Sample Spaces and Subsets. Define: Sample Space. Define: Intersection of two sets (A B) Define: Union of two sets (A B)

Sec 5.1 The Basics of Counting

Chapter 1: Sets and Probability

Mathematics. Programming

Transcription:

CSE 21 Math for Algorithms and Systems Analysis Lecture 2 Lists Without Repe>>on

Review of Last Lecture Sets and Lists Sets are unordered collec>on Lists are ordered collec>ons Rule of product # of lists with c i choices for the ith element is Cartesian Product c 1 c 2...c n S 1 S 2... S n = {x x is an n-list with the ith element x i S i }

Review Problems Construct the set of all possible dis>nct sequences of heads and tails that can be generated by flipping a coin 100 >mes? How many are there? Generate the set of all cards in the standard 52 card deck where each card is represented as a list with the first element being the rank of the card and the second being the suit

Review of Last Lecture Rela>onship between Cartesian Product and rule of Product S 1 S 2...S n = S 1 S 2... S n Lexicographical Ordering (think ordering of integers) for a, b P, a < L b, iff i, a i <b i,a 1 = b 1...,a i 1 = b i 1

Example Problems Con>nued Suppose for a par>cular game you want to organize your cards by suit, construct the set of all cards in the 52 card deck such that lexicographical order arranges cards by suit.

Dic>onary Ordering (not covered last lecture) Defines an ordering over lists. Keep in mind the intui>on of alphabe>cal order over words. x< d y iff ( i s.t. x i < y i and x 1 = y 1,...x i 1 = y i 1 ) or ( x < y and x 1 = y 1,...x x = y x )

Rule of Sum Suppose we want to count the number of elements in a set T. If we can divide the set into n disjoint subsets ( T i T j =,i= j ) subsets such that, T 1... T n = T then the number of elements in T is: T = T 1 +...+ T n

Applying the Rule of Sum A license plate from a state A is composed of 7 digits {0 9} the license plates from state B are composed of 7 le`ers {a z} How many license plates in total are there between the two states: Solu>on: form two sets Set 1: all license plates from state A Set 2: all license plates from state B

Applying the Rule of Sum 2 (example problem) A license plate from a state A is composed of 7 digits {0 9} the license plates from state B are composed of 1 alpha- numeric character {0 9, a z} followed by 6 digits {0 9}. How many license plates in total are there from state A and state B?

Example Problem Construct the set of non- nega>ve integers less than 10,000 where each integer is represented as a list of digits (no leading 0 s allowed). How many elements are in this set?

Example Problem 2 Galac>c Names In a certain distant galaxy, the alphabet contains only five symbols which we will represent as A, E, R, S, T. (A and E are called vowels, while R, S and T are consonants). All names are 5 le`ers long, begin and end with consonants and contain at least two vowels. Adjacent consonants must be the same, while adjacent vowels must be different. How many names are there?

Example Problem 2 (con>nued)

Example Problem College Commi`ees We are making a commi`ee from 4 departments consis>ng of (5, 8, 10, and 20 members). The commi`ee consists of 3 people where each must be from a different department. How many commi`ees can be made?

K- Lists Without Repe>>on There are a total of k- lists that can be made from an n- set with no repeated elements (if k > n then the answer is 0) n! (n k)!

How can we derive this using the rule of product? We have n choices for the first element of the k- list We have n- 1 choices for the second element of the k- list. We have n- k+1 choices for the kth element of the k- list

Example Problems How many ways can we seat 5 people in a row? How many ways can commi`ees consis>ng of a president, vice president, and treasurer can we make from a pool of 10 candidates?

Example Problem 2 How many words with all le`ers dis>nct can be made from the le`ers in the word (SUPERFLUOUS)?

Circular Arrangements Two circular arrangements are dis>nct if and only if there exists an element that has a different lep neighbor in the two arrangements. How many circular arrangements of size n can be made from the elements of an n- set? Can we figure this out using the rule of product?

Circular Arrangements (workspace)

Introduc>on to Lists With a limited Number of Repeated Values How many ways can the le`ers in the word ERROR be rearranged?

Matlab Demo