Discrrete mathematics for computer science random warmup

6 82 0
Discrrete mathematics for computer science random warmup

Đang tải... (xem toàn văn)

Thông tin tài liệu

Random Warmup Finding a Short Story • Suppose a book of short stories has both shorter short stories and longer short stories • Their order within the book is random • You want to pick a random story to read, but you would prefer it is a shorter one Finding a Short Story • Two Strategies – Strategy #1: Flip to a random page, back up to the beginning of that story, and start reading – Strategy #2: Flip to a random page, go forward to the beginning of the next story, and start reading • (Go to first story if you are at the end of the book) • Does it matter which strategy you use? To What Kind of Story Is a Random Page Likely to Belong • To be concrete, suppose there are 20 stories – 10 of them are 10 pages long – 10 of them are 20 pages lon • So book is 300 pages long • The Expected #pages in the story on a random page is (200∙20+100∙10)/300 = 16.7 • When you pick a random page, it will belong to a longer story with probability 2/3 The Second Strategy Works Better! • Strategy #1 will have you reading a longer story with probability 2/3 and a shorter story with probability 1/3 • Strategy #2 will take you to the beginning of a random STORY • So Strategy #2 will take you to the beginning of a longer story with probability ½ and a shorter story with probability ½ FINIS ... within the book is random • You want to pick a random story to read, but you would prefer it is a shorter one Finding a Short Story • Two Strategies – Strategy #1: Flip to a random page, back... page, back up to the beginning of that story, and start reading – Strategy #2: Flip to a random page, go forward to the beginning of the next story, and start reading • (Go to first story if you... So book is 300 pages long • The Expected #pages in the story on a random page is (200∙20+100∙10)/300 = 16.7 • When you pick a random page, it will belong to a longer story with probability 2/3

Ngày đăng: 22/03/2019, 11:54

Mục lục

  • Slide 1

  • Finding a Short Story

  • Finding a Short Story

  • To What Kind of Story Is a Random Page Likely to Belong

  • The Second Strategy Works Better!

  • FINIS

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan