All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General
Old Foskins (Posted on 2023-12-14) Difficulty: 3 of 5
MegaTech Insurance Co. has just bought out Old Line Insurance from Stodgy Corp. They have put the 10,000 policies from Old Line into their computer system, and today they will begin accepting new policies. Everything is computerized, but just to make sure, they will follow Old Line's long-time practice and have Old Foskins double-check all the policies.

The policies are stored alphabetically in the computer. Each morning a technician prints out the next 100 policies in sequence for Old Foskins to check by paper and pencil examination. Each evening 200 new policies are merged into the computer in alphabetic order.

How long will it take Old Foskins to reach the end of the list?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution same answer | Comment 2 of 8 |
Assuming the old policies and the new policies as they some in are perfectly distributed along the alphabet; and assuming that as new policies come in, if they occur earlier in the alphabet than Old Foskins is currently checking, then these earlier ones will never get checked.

An average of 100 runs showed 316.91 days; call it 317.
---------
import random
daylist = []
reps = 100
for rep in range(reps):
    policies = [i for i in range(10000)]
    day = 0
    current_policy = 0
    while current_policy < 10000:
        day += 1
        location = policies.index(current_policy) + 100
        if location > len(policies):
            break
        current_policy = policies[location]
        new_policies = [random.uniform(1, 10000) for i in range(200)]
        policies = sorted(policies + new_policies)
        progress = policies.index(current_policy) / len(policies)
    daylist.append(day)

print(sum(daylist)/reps)

  Posted by Larry on 2023-12-14 14:50:42
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information