(ii) Explain the three properties that any solution to the Critical Section Problem should guarantee. (C) Explain the role the Operating System plays in Garbage-In-Garbage-Out (GIGO).
Q: b) Consider a 5-card poker hand from a standard 52-card deck. How many hands contain three of a kind…
A: The above question is solved in step 2:-
Q: In the 8 queens problem, you are to place 8 queens on the chessboard in such a way that no two…
A: Q. What would the best choice be for states?Sol. A board with the position of all the queens that…
Q: Consider the search problem represented in Figure, where a is the start node and e is the goal…
A: For point a: < a, b > = 1, < b, d > = 1, < a, c > = 2, < c, e > = 1, < c,…
Q: Max and Min are the only two delivery men of Domino's Pizza. Assume the particular store received N…
A: Process: Initially take the input form the user the total possible delivery N Then Asked about the…
Q: Max and Min are the only two delivery men of Domino's Pizza. Assume the particular store received N…
A: According to the above listed problem statement we have to develop a python program that find out…
Q: Let us assume that the game company has designed a guarantee mechanism to encourage users to pay for…
A: Note : Answering the question in python as no language is mentioned. Task : Simulate the given…
Q: Here are the rules of another impartial combinatorial game of removing chips from a pile of chips.…
A: Given: 1.2 Here are the rules of another impartial combinatorial game of removing chips from a pile…
Q: A problem that was defined in the 13 century can be summarized as follows. A newborn pair of rabbits…
A: class rabbit { static double PHI = 1.6180339; static int f[] = {…
Q: 16. For certain claims A and B, Joe Palooka believes that P(A)= 0.3 and P(A V B)= 0.7. Choose the…
A: P(A) = 0.3 so P(~A) = 0.7 P(A or B) = P(A) + P(B) - P (A and B) = 0.7 => 0.3 + P(B) -0.7 = P(A…
Q: Q.1 We have three tasks A, B, C, that need to be assigned to two workers X and Y . We encode this…
A: Answers Propositional logic (PL) is the simplest form of logic where all the statements are made by…
Q: For the Grasses-planting problem, there are THREE squares that the farmer robot can be located and…
A: a) compute all possible states of this problem there are almost 24 states as considering the…
Q: Let A = {1,5,8,9). Are the following relations on A reflexive? 1. {(9,8), (8, 1), (1, 5), (9, 9),…
A: Answer the above question are as follows
Q: Q. Consider the dining philosophers problem where 5 philosophers are involved. Assume that there are…
A: Given;
Q: e version of the dining-philosophers problem in which the chopsticks are placed at the center of the…
A: Task : m = 4k n = 6k
Q: Note: Please Answer in C++ Only Mr. Cook is the manager of Code cinemas and after a long break the…
A: Start read the number of test cases T. For each test case, read the number of rows N and columns M.…
Q: Consider the following problem: You are baby-sitting n children and have m > n cookies to divide…
A: Greedy algorithm (children, cookies): Sort both the children by greed and the…
Q: Note: Please Answer in C++ Only Mr. Cook is the manager of Code cinemas and after a long break the…
A: In this question we need to write a C++ program to find the number of tickets that can be sold. We…
Q: There are four possible ways to cross the river for a person. Let the first location is denoted by…
A:
Q: In the rod cutting problem, we are given a rod of length n, along with pi, which indicates the price…
A: Consider the naive algorithm as shown below. Cut-Rod(p,n) If n==0 then return 0 r=-∞ for i=1 to…
Q: Let A = {1,2,3, 4, 5} and B = {1,2, 3, 4, 5, 6}. Give a set T C A®B so that following three…
A: A = {1,2,3,4,5}, B = {1,2,3,4,5,6} Tꓯ€ᴟø We have given relationship ᴝ AøB With three constraints…
Q: 2. A safe has 5 locks v, w, y and z; all of which must be unlocked for the safe to open. The keys to…
A: The number of locks given in the question is 5: v, w, x, y, and z. For unlocking these locks there…
Q: In the refrigerator example, suppose the warranty worksas follows. If a refrigerator fails at any…
A: Answer :
Q: How would you modify the dynamic programming algorithm for the coin collecting problem if some cells…
A: Finding optimal path of the board: copyable code: //Include the necessary header file #include…
Q: Question 8 E 4) Listen ► Consider the problem of determining whether there exists a route that…
A: According to the Bartelby guidelines we are suppose to answer only 3 sub part at a time. Kindly…
Q: Suppose you want to solvethe following equality 2?+?+3?+4?+6?=45 1. What is the chromosome…
A: Fitness operate Represents the most necessities of the required answer of a haul (i.e. most…
Q: Let A = {2, 4, 6, 8}, B = {6, 9}, C = {4, 8}. Answer each of the following questions. Justify your…
A: 1) We have three sets A = {2, 4, 6, 8}, B = {6, 9} and C = {4, 8} 2) ⊆ means is subset of 3) A…
Q: A seller has an indivisible asset to sell. Her reservation value for the asset is s, which she knows…
A: Answer: I have given answered in the handwritten format
Q: Note: Please Answer in C++ Only Mr. Cook is the manager of Code cinemas and after a long break the…
A: The question is to write c++ code for the given problem.
Q: Question 2: Consider the 0/1 knapsack problem. Given Nobjects where each object is specified by a…
A: a) Code for this problem #include <bits/stdc++.h> using namespace std; int max(int a,…
Q: A construction company has four large bulldozers located at four different garages. The bulldozers…
A:
Q: Consider the following 2-player game, X vs. Y. At each stage, an integer utility valu N is assigned…
A: Answer: I have given answered in the handwritten format in brief explanation
Q: This problem is known as the Three prisoners problem. Three prisoners, A, B and C, are in separate…
A: In this Three prisoner problem we will determine whether A is correct or C is correct by the given…
Q: Q1. Suppose that f: {0, 1}m→ {0, 1}™ is a prcimage resistant bijection. Definc h: {0, 1}2m → {0, 1}"…
A:
Q: Consider the following cryptarithmetic problem where TWO and FOUR are three and four digit numbers…
A: Cryptarithmetic Problem: A cryptarithmetic puzzle is a mathematical exercise in which some numbers'…
Q: It has been observed by management that some faculty member at the university demonstrates a…
A: Code: import java.util.*; public class Faculty { //below are the functions with…
Q: It has been observed by management that some faculty member at the university demonstratesa…
A: CODE:- #include<iostream>using namespace std;class Teacher_salary{ public:…
Q: C={c1,c2,… ,cm} (c1<c2<… <cm) be the arrangement of individuals who hold cardboards of 'C'. Let…
A: Here have to determine about the who hold cardboards programming problem statement.
Q: a Python program that uses breadth-first search algorithm to solve the above problem
A: Farmer-Wolf-Goat-Cabbage problem solution is implemented below: A farmer is attempting to cross a…
Q: Problem 7. Consider the island where knights always tell the truth, knaves always lie, and spies…
A: Dear Student, A says he is not a spy , there are two conditions either he is telling the truth or…
Q: Question 1. Suppose that the grading of x University courses is as follows: • Each student can get…
A: Java Source Code: import java.util.*; public class Question1 { int[] input=new int[5]; public…
Q: m where TWO and FOUR are three and four digit numbers respectively. Which of the following…
A: import java.util.Random;public class generateRandom{ public static void main(String args[]) {…
Q: Tom and Ron are the only two delivery men of Domino's Pizza. Assume the particular store received N…
A: Algortithm: Firstly take the input form the user the total possible delivery N Then Asked about the…
Q: Q. Consider the dining philosophers problem where 5 philosophers are involved. Assume that there are…
A: Problem: The dining philosophers problem is invented by E. W. Dijkstra. Imagine that five…
Q: It has been observed by management that some faculty member at the university demonstrates a…
A: Coded using Java.
Q: 3. Consider the three domains D1, D2, and D3 shown below: Y-axis! D (0, 0) X-axis Domain D3 consists…
A: Answer: Given Three domain D1,D2 and D3. I have given solution in handwritten format.
Q: Suppose there are 100 items, numbered 1 to 100, and also 100 baskets, also numbered 1 to 100. Item i…
A: Analysis of problem. Items : 1, 2, 3, 4, 5, 6 ,.........100 100 baskets such that item i divides b…
Q: Write a python code
A: You can use code like this for a fighting game import random class Fight(object): def enter(self):…
Q: Exercise 7.11 Suppose you are the "algorithmatician" of your company and the manager comes to you…
A: (i) The initial price is 100 and for every month cost increases by a factor of ri for ith book and i…
Q: Suppose you are provided an even number of people going on an adventure, and there are only…
A: According to the given problem statement we are required to develop a python code to find the max…
QUESTION THREE
A. Consider the thirsty person problem given below: To drink, a thirsty person must have three things; water, ice and a glass. There are three thirsty people, each having a different one (and only one) of the three required items. A fourth person, a server has unlimited supply of all three items. If nobody is drinking, the server places two of the three items (chosen at random) onto table. Thirsty person who can make a drink from those two items will pick them up and drink a glass of ice water. When done, thirsty person will notify the server and the process will repeat. Write a process that will control the thirsty person and the server using semaphores.
(B) (i)What is a critical section in code?
(ii) Explain the three properties that any solution to the Critical Section Problem should guarantee.
(C) Explain the role the
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
- Consider the version of the dining-philosophers problem in which the chopsticks are placed at the center of the table and any four of them can be used by a philosopher. In other words, a philosopher needs four chopsticks to eat. Assume that requests for chopsticks are made one at a time. Assuming that there are m=4k chopsticks and n=6k philosophers around the table, (i) How many maximum philosophers can eat simultaneously? (ii) Describe a simple rule for determining whether a particular request can be satisfied without causing deadlock given the current allocation of chopsticks to philosophers. (Hint: Use rules similar to the Banker’s algorithm.)We examine a problem in which we are handed a collection of coins and are tasked with forming a sum of money n out of the coins. The currency numbers are coins = c1, c2,..., ck, and each coin can be used as many times as we want. What is the bare amount of money required?If the coins are the euro coins (in euros) 1,2,5,10,20,50,100,200 and n = 520, we need at least four coins. The best option is to choose coins with sums of 200+200+100+20.a. Given n items, where each item has a weight and a value, and a knapsack that can carry at most W You are expected to fill in the knapsack with a subset of items in order to maximize the total value without exceeding the weight limit. For instance, if n = 6 and items = {(A, 10, 40), (B, 50, 30), (C, 40, 80), (D, 20, 60), (E, 40, 10), (F, 10, 60)} where each entry is represented as (itemIdi, weighti, valuei). Use greedy algorithm to solve the fractional knapsack problem. b. Given an array of n numbers, write a java or python program to find the k largest numbers using a comparison-based algorithm. We are not interested in the relative order of the k numbers and assuming that (i) k is a small constant (e.g., k = 5) independent of n, and (ii) k is a constant fraction of n (e.g., k = n/4). Provide the Big-Oh characterization of your algorithm.
- This problem exercises the basic concepts of game playing, using tic-tac-toe (noughtsand crosses) as an example. We define Xn as the number of rows, columns, or diagonals with exactly n X’s and no O’s. Similarly, On is the number of rows, columns, or diagonals with just n O’s. The utility function assigns +1 to any position with X3 = 1 and −1 to any position with O3 = 1. All other terminal positions have utility 0. For nonterminal positions, we use a linear evaluation function defined as Eval (s) = 3X2(s)+X1(s)−(3O2(s)+O1(s))."Mark on your tree the evaluations of all the positions at depth 2."Suppose that a manufacturing company builds n different types of robots, sayrobots 1, 2, . . . , n. These robots are made from a common set of m types of materials, saymaterials 1, 2, . . . , m. The company has only a limited supply of materials for each year,the amount of materials 1, 2, . . . , m are limited by the numbers b1, b2, . . . , bm, respectively.Building robot i requires an aij amount from material j. For example, building robot 1requires a11 from material 1, a12 from material 2, etc. Suppose the profit made by sellingrobot i is pi. Write an integer linear program for maximizing the annual profit for thecompanyAnswer the following: This problem exercises the basic concepts of game playing, using tic-tac-toe (noughts and crosses) as an example. We define Xn as the number of rows, columns, or diagonals with exactly n X’s and no O’s. Similarly, On is the number of rows, columns, or diagonals with just n O’s. The utility function assigns +1 to any position with X3=1 and −1 to any position with O3=1. All other terminal positions have utility 0. For nonterminal positions, we use a linear evaluation function defined as Eval(s)=3X2(s)+X1(s)−(3O2(s)+O1(s)). a. Show the whole game tree starting from an empty board down to depth 2 (i.e., one X and one O on the board), taking symmetry into account. b. Mark on your tree the evaluations of all the positions at depth 2. c .Using the minimax algorithm, mark on your tree the backed-up values for the positions at depths 1 and 0, and use those values to choose the best starting move. Provide original solutions including original diagram for part a!
- Answer the following: This problem exercises the basic concepts of game playing, using tic-tac-toe (noughts and crosses) as an example. We define Xn as the number of rows, columns, or diagonals with exactly n X’s and no O’s. Similarly, On is the number of rows, columns, or diagonals with just n O’s. The utility function assigns +1 to any position with X3=1 and −1 to any position with O3=1. All other terminal positions have utility 0. For nonterminal positions, we use a linear evaluation function defined as Eval(s)=3X2(s)+X1(s)−(3O2(s)+O1(s)). a. Show the whole game tree starting from an empty board down to depth 2 (i.e., one X and one O on the board), taking symmetry into account. b. Mark on your tree the evaluations of all the positions at depth 2. c .Using the minimax algorithm, mark on your tree the backed-up values for the positions at depths 1 and 0, and use those values to choose the best starting move. Provide original solution!Consider the challenge of determining whether a witness questioned by a law enforcement agency is telling the truth. An innovative questioning system pegs two individuals against each other. A reliable witness can determine whether the other individual is telling the truth. However, an unreliable witness's testimony is questionable. Given all the possible outcomes from the given scenarios, we obtain the table below. This pairwise approach could then be applied to a larger pool of witnesses. Answer the following: 1) If at least half of the K witnesses are reliable, the number of pairwise tests needed is Θ(n). Show the recurrence relation that models the problem. Provide a solution using your favorite programming language, that solves the recurrence, using initial values entered by the user.Consider the search problem represented in Figure, where a is the start node and e is the goal node. The pair [f, h] at each node indicates the value ofthe f and h functions for the path ending at that node. Given this information, what is the cost ofeach path?1. The cost < a, c >= 2 is given as a hint.2. Is the heuristic function h admissible? Explain
- Q-1. Consider the Farmer-Wolf-Goat-Cabbage Problem described below: Farmer-Wolf-Goat-Cabbage Problem There is a farmer with a wolf, a goat and a cabbage. The farmer has to cross a river with all three things. A small boat is available to cross the river, but farmer can carry only one thing with him at a time on the boat. In the absence of farmer, the goat will eat the cabbage and wolf will eat the goat. How can the farmer cross the river with all 3 things? State Space Formulation of the Problem State of the problem can be represented by a 4-tuple where elements of the tuple represent positions of farmer, wolf, goat and cabbage respectively. The position of boat is always same as the position of farmer because only farmer can drive the boat. Initial state: (L, L, L, L) Operators: 1. Move farmer and wolf to the opposite side of river if goat and cabbage are not left alone. 2. Move farmer and goat to the opposite side of river. 3. Move farmer and cabbage to the opposite…You and your friends decided to hold a “Secret Santa” gift exchange, where each person buys a gift for someone else. To see how this whole thing works, let’s consider the following example. Suppose there are 7 people A, B, C, D, E, F, and G. We denote x → y to mean “x gives a gift to y.” If the gift exchange starts with person A, then they give a gift to E. Then E gives a gift to B. And it is entirely possible that B gives a gift to A; in such a case we have completed a “cycle.” In case a cycle occurs, the gift exchange resumes with another person that hasn’t given their gift yet. If the gift exchange resumes with person D, then they give a gift to G. Then G gives a gift to F. Then F gives a gift to C. Then finally C gives a gift to D, which completes another cycle. Since all of the people have given their gifts, the giftexchange is done, otherwise the gift exchange resumes again with another person. All in all, there are two cycles that occurred during the gift exchange: A → E → B → A…Correct answer will be upvoted else downvoted. Let C={c1,c2,… ,cm} (c1<c2<… <cm) be the arrangement of individuals who hold cardboards of 'C'. Let P={p1,p2,… ,pk} (p1<p2<… <pk) be the arrangement of individuals who hold cardboards of 'P'. The photograph is acceptable if and provided that it fulfills the accompanying requirements: C∪P={1,2,… ,n} C∩P=∅. ci−ci−1≤ci+1−ci(1<i<m). pi−pi−1≥pi+1−pi(1<i<k). Given a cluster a1,… ,an, kindly track down the number of good photographs fulfilling the accompanying condition: ∑x∈Cax<∑y∈Pay. The appropriate response can be huge, so output it modulo 998244353. Two photographs are unique if and provided that there exists no less than one individual who holds a cardboard of 'C' in one photograph yet holds a cardboard of 'P' in the other. Input Each test contains numerous experiments. The main line contains the number of experiments t (1≤t≤200000). Depiction of the experiments follows. The…