answer.
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
Alinara [238K]
2 years ago
6

You're helping a group of ethnographers analyze some oral history data they've collected by interviewing members of a village to

learn about the lives of people who've lived there over the past two hundred years. From these Interviews, they've learned about a set of n people (all of them now deceased), whom we'll denote P_1, P_2,..., P_n. They've also collected facts about when these people lived relative to one another. Each fact has one of the following two forms:
For some i and j, person P, died before person Pj was born; or for some i and j, the life spans of P_i and P_j overlapped at least partially. Naturally, they're not sure that all these facts are correct; memories are not so good, and a lot of this was passed down by word of mouth.
So what they'd like you to determine is whether the data they've collected is at least Internally consistent, in the sense that there could have existed a set of people for which all the facts they've learned simultaneously hold.
Give an efficient algorithm to do this: either it should produce proposed dates of birth and death for each of the n people so that all the facts hold true, or it should report (correctly) that no such dates can exist—that is, the facts collected by the ethnographers are not internally consistent.
Computers and Technology
1 answer:
Xelga [282]2 years ago
3 0

Answer:

Algorithm given below

Explanation:

<u>Algorithm: </u>

proc create-node( event )

     out-adj-list[event] <- empty-list

     in-degree[event] <- 0

   endproc

   proc create-edge( start, end )

     push( out-adj-list[ start ], end )

     in-degree[ end ] <- in-degree[ end ] + 1

   endproc

   for p \in { P_i }

     create-node( birth[p] )

     create-node( death[p] )

     create-edge( birth[p], death[p] )

   endfor

   for (p, q) \in DiedBefore

     create-edge( death[p], birth[q] )

   endfor

   for (p, q) \in Coexisted

     create-edge( birth[p], death[q] )

     create-edge( birth[q], death[p] )

   endfor

   eligible-node-list <- empty-list

   for p \in { P_i }

     if in-degree[ birth[p] ] = 0

       push(eligible-node-list, birth[p])

     endif

   endfor

   event-date-separation = 200yrs / (2*|{P_i}|)

   order <- 0

   while eligible-node-list is non-empty

     event = pop(eligible-node-list)

     order <- order + 1

     dates[ event ] = START_DATE + order * event-date-separation

     for following-event \in out-adj-list[event]

       in-degree[ following-event ] <- in-degree[ following-event ] - 1

if in-degree[ following-event ] = 0

                       push( eligible-node-list, following-event )

           endif

     endfor

   endwhile

   if order < 2*|{P_i}|

     return INCONSISTENT_DATA

   else

     return CONSISTENT_DATA, dates

   endif

You might be interested in
Given the macro definition and global declarations shown in the image below, provide answers to the following questions:
galben [10]

Answer:

A. 243

B. True

C. 0

Explanation:

Macro instruction is a line of coding used in computer programming. The line coding results in one or more coding in computer program and sets variable for using other statements. Macros allows to reuse code. Macro has two parts beginning and end. After the execution of statement of quiz4 x, 4 the macro x will contain 243. When the macro is invoked the statement will result in an error. When the macro codes are executed the edx will contain 0. Edx serve as a macro assembler.

4 0
2 years ago
Referential integrity constraints are concerned with checking INSERT and UPDATE operations that affect the parent child relation
Jet001 [13]

Answer:

a) true

Explanation:

In Computer programming, integrity constraints can be defined as a set of standard rules that ensures quality information and database are maintained.

Basically, there are four (4) types of integrity constraints and these are;

1. Key constraints.

2. Domain constraints.

3. Entity integrity constraints.

4. Referential integrity constraints.

Referential integrity is a property of data which states that each foreign key value must match a primary key value in another relation or the foreign key value must be null.

For instance, when a foreign key in Table A points to the primary key of Table B, according to the referential integrity constraints, all the value of the foreign key in Table A must be null or match the primary key in Table B.

Hence, the referential Integrity constraints ensures that the relationship between the data in a table is consistent and valid.

Hence, referential integrity constraints are concerned with checking INSERT and UPDATE operations that affect the parent child relationships.

<em>This ultimately implies that, referential Integrity are rules used in database management systems (DBMS) to ensure relationships between tables when records are changed is VALID (INSERT and UPDATE).</em>

<em>In a nutshell, it always ensures a primary key must have a matching foreign key or it becomes null. </em>

6 0
2 years ago
Write a method called fact that recursively calculates the factorial value of its single int parameter. The value returned by fa
andrey2020 [161]

Answer:

The program to this question can be given as follows:

Program:

//class

public class factorial //defining class

{

//method fact

public static long fact(int x1) //defining method fact

{

//conditional statement

if (x1 <= 1) //if block checks parameter value less then equal to 1

{

return 1; //return value

}

else //else part

{

return (fact(x1 - 1) * (long) x1); //return factors using recursive function

}

}

//method main

public static void main(String[] args) //defining main method

{

long data=fact(5);//defining variable that holds function value

System.out.println("Factorial is: "+data); //print value

}

}

Output:

Factorial is: 120

Explanation:

In the above java program, a class is "factorial" is defined, inside the class, a static method "fact" is declared, that accepts an integer parameter that is "x1" and returns a long value, inside this method a conditional statement is used.

  • If the block it checks parameter value is less then equal to 1, if this condition is true, it will return 1 when this condition is not true. It will go in else part.
  • In else part, it uses a recursive function to calculate factorial of a number and return its value.
  • Then the main method is defined, inside this method a long variable "data" is defined, that call and holds fact function return value, and in the next line, the print function is used to print the data variable value.

6 0
2 years ago
Match the careers with the career clusters.
creativ13 [48]
<h2>Answer and Explanation:</h2>

The picture shows the right careers with their respective career clusters.

4 0
2 years ago
Read 2 more answers
Suggest how the following requirements might be rewritten in a quantitative way. You may use any metrics you like to express the
kotegsom [21]

Answer:

Did you get the answer yet or not or should i sent it?

Explanation:

3 0
2 years ago
Other questions:
  • Marissa works at a company that makes perfume. She noticed many samples of the perfume were not passing inspection. She conducte
    6·2 answers
  • Can someone please help me with this
    9·1 answer
  • Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the g
    12·2 answers
  • When configuring a record type, an App Builder can configure the available value of a picklist field for the page layout. Which
    9·1 answer
  • A Salesforce administrator adding a recommendations carousel component in Community Builder. The page displays correctly in Comm
    12·1 answer
  • (Package Inheritance Hierarchy) Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping o
    10·1 answer
  • A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a fi
    12·1 answer
  • Write a method that will receive 2 numbers as parameters and will return a string containing the pattern based on those two numb
    10·1 answer
  • What prevents someone who randomly picks up your phone from sending money to themselves using a messenger-based payment?
    14·1 answer
  • A data analyst is using the Color tool in Tableau to apply a color scheme to a data visualization. They want the visualization t
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!