This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 202: Data Structures and Discrete Mathematics II Fall 2010 Homework 1 (Due September 8 in Class) Solutions (prepared by Nick D. Shaskevich) 3. 10 points (5+5) (a) If n is a multiple of 3, how many numbers are there that are multiples of 3 between n and n + 300 (inclusively)? Solution: 101 Explanation: • n is divisible by 3 so we can write it as n = 3 k for some value of k • The range we are looking at goes from 3 k to 3 k +300. Note that 3 k +300 = 3 · ( k +100) and 3 k = 3 · ( k +0) • Any number of the form 3 · ( k + i ), where i is an integer ( ..., 2 , 1 , , 1 , 2 ,... ), is divisible by 3. • Our i starts at 0 giving 3 · ( k +0) = 3 k = n and it ends at 3 · ( k +100) = 3 k +300 = n +300 • The total number of divisible numbers is 1000+1 = 101 (b) All Internet traffic comes in packets: your email, a webpage you view, a video you are watching  are all broken up into packets when they travel over the In ternet. Packets have IDs and the content is assembled at the receiver end by putting the arriving packets in the order of their IDs. Assume each packet con tains 1,000 bytes and the message gets broken up into nonoverlapping packets. Suppose you are loading a webpage of size 30,523 bytes and the ID of the first packet for the webpage is 1412. What is the ID of the last packet for the webpage? Solution: 1442 Explanation: • 30,523 total bytes · 1 packet 1 , 000 bytes = 30.523 packets • This means we send 30 full packets and the last packet is only half full (or 52.3% full for the anally retentive) • 30 full packets + 1 halffull packet = 31 packets sent • Packet 1 has ID 1412, Packet 2 has ID 1413, ... , Packet i has ID (1412+ i1). The last packet has ID 1412+311 = 1442 4. 18 points (8+5+5) 11 CS 202 Homework 1 Due September 8 in Class (a) Suppose an elimination game is played where in each round at least one player is eliminated. A player is eliminated if s/he ranks lowest for the round (ties of at most three players are possible). How many possible game scenarios are there with 4 players? Draw the possibilities tree and justify the answer. Solution + Explanation • Each round eliminates 1 to 3 people: one person if there are no ties, two people if two people tie and they both have the lowest ranks, and three people if three people tie and they have the lowest ranks. • Starting with 4 players, we draw the possibilities tree: 4 players 3 players 2 players 1 player wins 1 e lim in a te d 2 eliminated 3 e lim in a te d 2 players 1 player wins NO player wins 1 e lim in a te d 2 e lim in a te d 3 eliminated 1 player wins NO player wins 1 eliminated 2 e lim in a te d 1 player wins NO player wins 1 elim inated 2 eliminated • Since there are 7 terminal nodes in the possibilities tree, there are 7 game scenarios....
View
Full Document
 Spring '08
 STAFF
 Data Structures, total number, Disjoint sets, Discrete Mathematics II, +s, Nick D. Shaskevich

Click to edit the document details