Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8749407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:41:25+00:00 2026-06-13T12:41:25+00:00

Problem: Given integers n and k, along with p 1 ,p 2 ,…, p

  • 0

Problem:

Given integers n and k, along with p1,p2,..., pn; where pi ε [0, 1], you want to determine the probability of obtaining exactly k heads when n biased coins are tossed independently at random, where pi is the probability that the ith coin comes up heads. Give an O(n2) algorithm for this task. Assume you can multiply and add two numbers in [0, 1] in O(1) time.

Can somebody help me with developing the recurrence relation so that I may code it. (The question comes from back exercise of chapter Dynamic Programming in book “Algorithms By Dasgupta”)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:41:26+00:00Added an answer on June 13, 2026 at 12:41 pm

    Consider the situation when (n-1) coins are tossed together and nth coin is tossed apart and take into account mutual independence.

    Combine probabilities of simpler cases to get P(1..n, k) (where P(1..n, k) is the probability of obtaining exactly k heads when n coins)

    Then apply this rule and fill all the cells in NxK table

    Edit:

    There are two possible ways to get exactly k heads with n coins –

    a) if (n-1) coins have k heads, and Nth coin is tail, and

    b) if (n-1) coins have k-1 heads, and Nth coin is head

    so

    P(n, k) = P(n-1, k) * (1 – p[n]) + P(n-1, k-1) * p[n]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem is taken from interviewstreet.com Given array of integers Y=y1,...,yn, we have n
I'm simplifying a larger complex problem with the following... Given three arrays of integers,
Problem Given two integers a, b, a < b. Display its decimal expansion. You
This problem is really confusing me; we're given two integers A , B ,
Consider this problem: You are given an array containing positive integers. All the integers
how to solve this problem: We are given N pairs of integers. For each
I have an optimization problem as follows. Given an array of positive integers, e.g.
The problem statement from leetcode says: Given an array S of n integers, are
The original problem statement is this one: Given an array of 32bit unsigned integers
Here's the description of this problem: You are given two integers a and b.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.