1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mamaluj [8]
3 years ago
12

Let m be an integer in the set {0,1,2,3,4,5,6,7,8, 9}, and consider the following problem: determine m by asking 3-way questions

, i.e. questions with at most 3 possible answers. For instance, one could ask which of 3 specific subsets m belongs to.
Give a decision tree argument showing that at least 3 such questions are necessary in worst case. In other words, prove that no correct algorithm can solve this problem by asking only 2 questions in worst case.

Engineering
1 answer:
kupik [55]3 years ago
5 0

Answer:

Take any algorithm if that algorithm solves this problem it can be represented as a ternary decision tree. Therefore each question has at most three answers.

There are ten possible verdicts, the height of such kind of tree should satisfy

ℎ >= ⌈log3(10)⌉ = 3

Hence no such algorithm can ask less than three questions in the worst case.

---

b)

Each and every internal node represents a question asking whether m belongs to one of three possible subset of {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} or not

For example 0123|456|789 represented the questionDoes “m: belongs to {0, 1, 2, 3}, to {4, 5, 6}, or to {7, 8, 9}?"

Verdicts are placed in brackets "[ ]"

Explanation:

decision tree is attached below

You might be interested in
Two grenades, A and B, are thrown horizontally with different speeds from the top of a cliff 70 m high. The speed of A is 2.50 m
Aloiza [94]

Explanation:

uuui ielts k oshru with the best of my life u

3 0
3 years ago
Question 1 : Replacement [42 Pts] Consider the following page reference string:
MakcuM [25]

Answer:

Optimal

Time 123456789101112

RS. ecbeagdcegda

F0. eeeeeeeee e e a

F1 c c c c c c c c c c c

F2 b b b g g g g g g g

F3 a a d d d d d d

Page fault? * * * * * * *

Total page fault:7

2. LRU

Time 1 2 3 4 5 6 7 8 9 10 11 12

RS e c b e a g d c e g d a

F0 e e e e e e e c c c c a

F1 c c c c g g g g g g g

F2 b b b b d d d d d d

F3 a a a a e e e e

Page fault? Y Y Y N Y Y Y Y Y N N Y Total page fault:9

3. LRU approximation algorithm: Second chance

Time 1 2 3 4 5 6 7 8 9 10 11 12

RS e c b e a g d c e g d a

F0 0,e 0,e 0,e 1,e 1,e 0,e 0,e 0,e 1,e 1,e 1,e 0,e

F1 0,c 0,c 0,c 0,c 0,g 0,g 0,g 0,g 1,g 1,g 0,g

F20,b0,b0,b0,b0,d0,d0,d0,d1,d0,dF30,a0,a0,a0,c0,c0,c0,c0,a

Page fault? YYYNYYYYNNNY

Total page fault: 8

4 0
3 years ago
Read 2 more answers
Air is compressed from 100 kPa, 300 K to 1000 kPa in a two-stage compressor with intercooling between stages. The intercooler pr
Brut [27]

Answer:

The total compressor work is 234.8 kJ/kg for a isentropic compression

Explanation:

Please look at the solution in the attached Word file

Download docx
6 0
4 years ago
IN JAVA,
Citrus2011 [14]

Answer:

Explanation:

Code:

import java.io.File;

import java.io.FileWriter;

import java.io.IOException;

import java.util.Scanner;

public class Knapsack {

 

  public static void knapsack(int wk[], int pr[], int W, String ofile) throws IOException

  {

      int i, w;

      int[][] Ksack = new int[wk.length + 1][W + 1];

     

      for (i = 0; i <= wk.length; i++) {

  for (w = 0; w <= W; w++) {

  if (i == 0 || w == 0)

  Ksack[i][w] = 0;

  else if (wk[i - 1] <= w)

  Ksack[i][w] = Math.max(pr[i - 1] + Ksack[i - 1][w - wk[i - 1]], Ksack[i - 1][w]);

  else

  Ksack[i][w] = Ksack[i - 1][w];

  }

  }

     

      int maxProfit = Ksack[wk.length][W];

      int tempProfit = maxProfit;

      int count = 0;

      w = W;

      int[] projectIncluded = new int[1000];

      for (i = wk.length; i > 0 && tempProfit > 0; i--) {

         

      if (tempProfit == Ksack[i - 1][w])

      continue;    

      else {

          projectIncluded[count++] = i-1;

      tempProfit = tempProfit - pr[i - 1];

      w = w - wk[i - 1];

      }

     

      FileWriter f =new FileWriter("C:\\Users\\gshubhita\\Desktop\\"+ ofile);

      f.write("Number of projects available: "+ wk.length+ "\r\n");

      f.write("Available employee work weeks: "+ W + "\r\n");

      f.write("Number of projects chosen: "+ count + "\r\n");

      f.write("Total profit: "+ maxProfit + "\r\n");

     

  for (int j = 0; j < count; j++)

  f.write("\nProject"+ projectIncluded[j] +" " +wk[projectIncluded[j]]+ " "+ pr[projectIncluded[j]] + "\r\n");

  f.close();

      }    

  }

 

  public static void main(String[] args) throws Exception

  {

      Scanner sc = new Scanner(System.in);

      System.out.print("Enter the number of available employee work weeks: ");

      int avbWeeks = sc.nextInt();

      System.out.print("Enter the name of input file: ");

  String inputFile = sc.next();

      System.out.print("Enter the name of output file: ");

      String outputFile = sc.next();

      System.out.print("Number of projects = ");

      int projects = sc.nextInt();

      int[] workWeeks = new int[projects];

      int[] profit = new int[projects];

     

      File file = new File("C:\\Users\\gshubhita\\Desktop\\" + inputFile);

  Scanner fl = new Scanner(file);

 

  int count = 0;

  while (fl.hasNextLine()){

  String line = fl.nextLine();

  String[] x = line.split(" ");

  workWeeks[count] = Integer.parseInt(x[1]);

  profit[count] = Integer.parseInt(x[2]);

  count++;

  }

 

  knapsack(workWeeks, profit, avbWeeks, outputFile);

  }

}

Console Output:

Enter the number of available employee work weeks: 10

Enter the name of input file: input.txt

Enter the name of output file: output.txt

Number of projects = 4

Output.txt:

Number of projects available: 4

Available employee work weeks: 10

Number of projects chosen: 2

Total profit: 46

Project2 4 16

Project0 6 30

8 0
3 years ago
Visual interpretations when driving are two things: first, what the driver sees around him or her passively, so it is what the e
Phoenix [80]

Answer:

A. How the driver understands and processes the things his or her eyes receive.

Explanation:

When driving, visual interpretation occurs in two things;

  • What the driver sees around him or her passively, mainly what is received by the eye
  • How the driver understands and processes the things his or her eyes receive

Proper vision is vital while driving. There is the central vison and the peripheral vision. The central vision is what the driver sees in front through the windshield straight ahead. The Peripheral vision is what is seen at the corners of the eyes.

8 0
3 years ago
Other questions:
  • An aluminum heat sink (k = 240 W/m-K) used to cool an array of electronic chips consists of a square channel of inner width w =
    6·2 answers
  • ) A 20 ft horizontal beam is attached to a wall with a fixed support. If the beam is subjected to the distributed loads indicate
    12·1 answer
  • A suspension of Bacillus subtilis cells is filtered under constant pressure for recovery of protease. A pilot-scale filter is us
    6·1 answer
  • Write a C program that will update a bank balance. A user cannot withdraw an amount ofmoney that is more than the current balanc
    13·1 answer
  • A rectangular concrete (n=0.013) channel 20 feet wide, on a 2.5% slope, is discharging 400 ft3 /sec into a stilling basin. The s
    13·1 answer
  • 2.18 The net potential energy between two adjacent ions, EN, may be represented by the following equation: (1) Calculate the bon
    5·1 answer
  • Large quantities of liquefied natural gas (LNG) are shipped by ocean tanker. At the unloading port, provision is made for vapori
    6·1 answer
  • A fluid of viscosity 0.2 kg/m⋅s flows steadily through a 0.10 m diameter pipe with a velocity profile given by vz = 2.0[1 – (r/R
    10·1 answer
  • ⚠️Answer needed quick!!⚠️
    5·1 answer
  • The MAP sensor's vacuum hose is loose and cracking. Technician A says this sensor measures air mass to establish the fuel inject
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!