Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Question
Chapter 33, Problem 5P
a.
Program Plan Intro
To show how to compute the convex hull of all
b.
Program Plan Intro
To show how to compute the convex hull of a set of n points with
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The Partitioning Problem: Given a set ofnpositive integers, partition the integers into two subsets of equal or almost equal sum. The goal is to partition the input numbers into two groups such that the difference between the sums of the elements in the two group is minimum or as small as possible.
a) Since no polynomial solutions are known for the above problem, implement an exponential algorithm for finding the optimal solution for any instance of the problem and test it for small input samples. Identify the maximum input size for which an optimal solution is possible to obtain using your algorithm in reasonable time (for example 3 hours). Hint: Every possible partition (solution) can be represented by a binary array of sizen
Consider a text corpus consisting of N tokens of d distinct words and the number of times each distinct word w appears is given by . We want to apply a version of Laplace smoothing that estimates a word's probability as: xw+a/ N+ad for some constant a (Laplace recommended a = 1, but other values are possible.) In the following problems, assume N is 100,000, d is 10,000 and a is 2.
A. Give both the unsmoothed maximum likelihood probability estimate and the Laplace smoothed estimate of a word that appears 1,000 times in the corpus.
B. Do the same for a word that does not appear at all.
C. You are running a Naive Bayes text classifier with Laplace Smoothing, and you suspect that you are overfitting the data. How would you increase or decrease the parameter a?
D. Could increasing a increase or decrease training set error? Increase or decrease validation set error?
Conditional Probability
How do I find P(A) and also P(B) given P(C) P(C') P(AlC) P(BlC) P(AlC') and P(BlC').
And how do I find out if P(A) and P(B) are independent?
Chapter 33 Solutions
Introduction to Algorithms
Ch. 33.1 - Prob. 1ECh. 33.1 - Prob. 2ECh. 33.1 - Prob. 3ECh. 33.1 - Prob. 4ECh. 33.1 - Prob. 5ECh. 33.1 - Prob. 6ECh. 33.1 - Prob. 7ECh. 33.1 - Prob. 8ECh. 33.2 - Prob. 1ECh. 33.2 - Prob. 2E
Ch. 33.2 - Prob. 3ECh. 33.2 - Prob. 4ECh. 33.2 - Prob. 5ECh. 33.2 - Prob. 6ECh. 33.2 - Prob. 7ECh. 33.2 - Prob. 8ECh. 33.2 - Prob. 9ECh. 33.3 - Prob. 1ECh. 33.3 - Prob. 2ECh. 33.3 - Prob. 3ECh. 33.3 - Prob. 4ECh. 33.3 - Prob. 5ECh. 33.3 - Prob. 6ECh. 33.4 - Prob. 1ECh. 33.4 - Prob. 2ECh. 33.4 - Prob. 3ECh. 33.4 - Prob. 4ECh. 33.4 - Prob. 5ECh. 33.4 - Prob. 6ECh. 33 - Prob. 1PCh. 33 - Prob. 2PCh. 33 - Prob. 3PCh. 33 - Prob. 4PCh. 33 - Prob. 5P
Knowledge Booster
Similar questions
- Generate 100 synthetic data points (x,y) as follows: x is uniform over [0,1]10 and y = P10 i=1 i ∗ xi + 0.1 ∗ N(0,1) where N(0,1) is the standard normal distribution. Implement full gradient descent and stochastic gradient descent, and test them on linear regression over the synthetic data points. Subject: Python Programmingarrow_forwardIn every instance (i.e., example) of the TSP, we are given n cities, where each pair of cities is connected by a weighted edge that measures the cost of traveling between those two cities. Our goal is to find the optimal TSP tour, minimizing the total cost of a Hamiltonian cycle in G. Although it is NP-complete to solve the TSP, there is a simple 2-approximation achieved by first generating a minimum-weight spanning tree of G and using this output to determine our TSP tour. Prove that our output is guaranteed to be a 2-approximation, provided the Triangle Inequality holds. In other words, if OPT is the total cost of the optimal solution, and APP is the total cost of our approximate solution, clearly explain why APP≤ 2∗OPT.arrow_forwardFrom 1965 to 1974, in U.S. there were M = 17, 857, 857 male livebirths and F = 16, 974, 194 female livebirths. We model the number of male livebirth as a binomial distribution with parameters size = M+F and prob = p. The following code computes the maximum likelihood estimator for p. M <- 17857857 F <- 16974194 ll <- function(p){ dbinom(M, size=M+F, prob=p, log=TRUE) } ps <- seq(0.01, 0.99, by = 0.001) ll.ps <- ll(ps) plot(ps, ll.ps, type='l') phat <- ps[which.max(ll.ps)] abline(v = phat, col='blue') Question: What can we learn from the plot?arrow_forward
- From 1965 to 1974, in U.S. there were M = 17, 857, 857 male livebirths and F = 16, 974, 194 female livebirths. We model the number of male livebirth as a binomial distribution with parameters size = M+F and prob = p. The following code computes the maximum likelihood estimator for p. M <- 17857857 F <- 16974194 ll <- function(p){ dbinom(M, size=M+F, prob=p, log=TRUE) } ps <- seq(0.01, 0.99, by = 0.001) ll.ps <- ll(ps) plot(ps, ll.ps, type='l') phat <- ps[which.max(ll.ps)] abline(v = phat, col='blue') Question: An estimator for p, denoted by pˆ, is obtained by ps[which.max(ll.ps)]. Is this the maximum likelihood estimator? Why (explain the code)?arrow_forwardConsider a graph G in the following Find a path from a to g in the graph G using each search strategy of depth-first search, breadth-first search, least-cost search, best-first search, and A* search. Is the returned solution path an optimal one?arrow_forwardANY help would be greatly appreciated. From 1965 to 1974, in U.S. there were M= 17,857,857 male livebirths and F= 16,974,194 female livebirths. We model the number of male livebirth as a binomial distribution withparameterssize = M+F and prob = p. The following code computes the maximum likelihood estimator for p. male = 17857857 female = 16974194 ll <-function(p){dbinom(male, size = male+female, prob=p, log=TRUE) } ps <-seq(0.01, 0.99, by = 0.001) ll.ps <-ll(ps) plot(ps, ll.ps, type='l') phat <- ps[which.max(ll.ps)] abline(v = phat, col='blue') QUESTION: For this problem, can you give a theoretical formula for the maximum likelihood estimator,ˆp, usingMandF? (No need to compute the numerical value.)arrow_forward
- Linear regression aims to learn the parameters 7 from the training set D = {(f(),y(i)), i {(x(i),y(i)),i = 1,2,...,m} so that the hypothesis ho(x) = ēr i can predict the output y given an input vector š. Please derive the least mean squares and stochastic gradient descent update rule, that is to use gradient descent algorithm to update Ô so as to minimize the least squares cost function JO).arrow_forwardAnalysis of Linear search (Worst, Average and Best Cases)#include <stdio.h>// Linearly search x in arr[]. If x is present then return the index,// otherwise return -1int search(int arr[], int n, int x){ int i; for (i=0; i<n; i++) { if (arr[i] == x) return i; } return -1;}arrow_forward2. Given a Sample Space S = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, Event A = {1, 3, 4, 7, 9}, and Event B = {3, 7, 9, 11, 12, 13} Find the probability P(A|B). State your answer as a value with one digit after the decimal point.arrow_forward
- Solve in R programming language: Let the random variable X be defined on the support set (1,2) with pdf fX(x) = (4/15)x3. (a) Find p(X<1.25). (b) Find EX. (c) Find the variance of X.arrow_forwardConsider a collection C of subsets of a finite set V . (V, C) is called a hypergraph. A hypergraph (V, C) is 3-regular if every subset in C contains exactly three elements. A subcollection M of C is a matching if all subsets in M are disjoint. Show that there exists a polynomial-time 3-approximation for the maximum matching problem in 3-regular hypergraphs as follows: Given a 3-regular hypergraph, find a matching with maximum cardinality.arrow_forwardSingle Point based Search: Fair share problem: Given a set of N positive integers S={x1, x2, x3,…, xk,… xN}, decide whether S can be partitioned into two sets S0 and S1 such that the sum of numbers in S0 equals to the sum of numbers in S1. This problem can be formulated as a minimisation problem using the objective function which takes the absolute value of the difference between the sum of elements in S0 and the sum of elements in S1. Assuming that such a partition is possible, then the minimum for a given problem instance would have an objective value of 0. A candidate solution can be represented using a binary array r=[b1, b2, b3,…, bk,… bN], where bk is a binary variable indicating which set the k-th number in S is partitioned into, that is, if bk =0, then the k-th number is partitioned in to S0, otherwise (which means bk =1) the k-th number is partitioned in to S1. For example, given the set with five integers S={4, 1, 2, 2, 1}, the solution [0,1,0,1,1] indicates that S is…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks Cole
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole