5. Permutations+Combinations - MATH 224 – Discrete...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 8/27/09 8/27/09 MATH 224 – Discrete Mathematics Counting In the code segments below what happens to x? What is the value of x after executing the code on the right, after executing the code on the left? 11 = ; x = ; x ( = ; < ; ++) for i 0 i m i ( = ; < ) { for i 0 i m = + ; x x 1 ( = ; > ; = / ) for j n j 0 j j 2 ( = ; > ; = / ) for j n j 0 j j 2 = + ; x x 1 = + ; x x 1 } // rof 8/27/09 8/27/09 MATH 224 – Discrete Mathematics Counting Basic counting techniques are important in many aspects of computer science. For example, consider the two code segments below. What is the value of x after executing the code on the right, after executing the code on the left? 22 = ; x = ; x ( = ; < ; ++) for i 0 i m i ( = ; < ) { for i 0 i m = + ; x x 1 ( = ; < ; ++) for j 0 j n j ( = ; < ; ++) for j 0 j n j = + ; x x 1 = + ; x x 1 } // rof 8/27/09 8/27/09 MATH 224 – Discrete Mathematics Counting License plate numbers Consider a license plate that has six characters where the first 3 are digits and the last three are upper case letters. If zeros are not allowed for the first two digits and there are five three letter sequences that are not allowed, how many different license plates are possible. 3 With three decimal digits there are 1000 possible . , numbers There are 100 numbers with a leading zero which includes those numbers where the first two digits . – = are zeros As a result there are 1000 100 900 . possible 3 digit sequences Then there are 26 3 = , 17 576 three character sequence . * , with five not allowed So we have a total of 900 17 571 = 15,813,900 8/27/09 8/27/09 MATH 224 – Discrete Mathematics Counting IPv4 Internet Addresses Each address consists of 4 bytes, that is written as four decimal numbers. For example, the internet address of the CS web pages is 146.163.144.6. Each of the four parts is written as a decimal number that may take on values between 0 and 255. What is the total number of addresses that are available? 256 4 = 4,294,967,296 Some of these are not used as address, but have special meaning. So for example the first byte may not be 0 or 255. In addition, the last byte may not be 0 or 255. Let’s determine the number of addresses taking these restrictions into...
View Full Document

This note was uploaded on 08/26/2009 for the course MATH 224 taught by Professor Waxman during the Fall '08 term at Southern Illinois University Edwardsville.

Page1 / 14

5. Permutations+Combinations - MATH 224 – Discrete...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online