SlideShare a Scribd company logo
1 of 2
Download to read offline
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 those interviews, they’ve learned about a set of n people (all of them now deceased), whom
we’ll denote P1, P2, . . . , Pn. They’ve also collected facts about when these people lived relative
to one another. Each fact has one of the two following forms:
• Person Pi died before person Pj was born.
• The life spans of Pi and Pj overlapped at least partially. (Here Pi and Pj are two specific people
whom the fact is about.)
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 algorithm with polynomial running time 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.
Solution
Algorithm:
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

More Related Content

More from feelinggifts

Which of the following is not a function of interest groups A. to i.pdf
Which of the following is not a function of interest groups A. to i.pdfWhich of the following is not a function of interest groups A. to i.pdf
Which of the following is not a function of interest groups A. to i.pdffeelinggifts
 
When explaining civil law one would say that it is concemed with disp.pdf
When explaining civil law one would say that it is concemed with disp.pdfWhen explaining civil law one would say that it is concemed with disp.pdf
When explaining civil law one would say that it is concemed with disp.pdffeelinggifts
 
What is the difference between a short and long branchSolution.pdf
What is the difference between a short and long branchSolution.pdfWhat is the difference between a short and long branchSolution.pdf
What is the difference between a short and long branchSolution.pdffeelinggifts
 
What is the maximum file size in a FAT32 systemSolutionFirst .pdf
What is the maximum file size in a FAT32 systemSolutionFirst .pdfWhat is the maximum file size in a FAT32 systemSolutionFirst .pdf
What is the maximum file size in a FAT32 systemSolutionFirst .pdffeelinggifts
 
View transaction list Journal entry worksheet The company paid $510 c.pdf
View transaction list Journal entry worksheet The company paid $510 c.pdfView transaction list Journal entry worksheet The company paid $510 c.pdf
View transaction list Journal entry worksheet The company paid $510 c.pdffeelinggifts
 
The numeric data types in C++ can be broken into two general categori.pdf
The numeric data types in C++ can be broken into two general categori.pdfThe numeric data types in C++ can be broken into two general categori.pdf
The numeric data types in C++ can be broken into two general categori.pdffeelinggifts
 
The capillaries at the alveoli Form a respiratory membrane Are spe.pdf
The capillaries at the alveoli  Form a respiratory membrane  Are spe.pdfThe capillaries at the alveoli  Form a respiratory membrane  Are spe.pdf
The capillaries at the alveoli Form a respiratory membrane Are spe.pdffeelinggifts
 
Select the word or phrase which best matches the description of it..pdf
Select the word or phrase which best matches the description of it..pdfSelect the word or phrase which best matches the description of it..pdf
Select the word or phrase which best matches the description of it..pdffeelinggifts
 
Robin Hood has hired you as his new Strategic Consultant to help him.pdf
Robin Hood has hired you as his new Strategic Consultant to help him.pdfRobin Hood has hired you as his new Strategic Consultant to help him.pdf
Robin Hood has hired you as his new Strategic Consultant to help him.pdffeelinggifts
 
Research indicates that online news seekers tend to access topics of.pdf
Research indicates that online news seekers tend to access topics of.pdfResearch indicates that online news seekers tend to access topics of.pdf
Research indicates that online news seekers tend to access topics of.pdffeelinggifts
 
Read Case Study Room 406 and answer the following questions in 2.pdf
Read Case Study Room 406 and answer the following questions in 2.pdfRead Case Study Room 406 and answer the following questions in 2.pdf
Read Case Study Room 406 and answer the following questions in 2.pdffeelinggifts
 
QUESTION 1A business system is a(n)A.collection of operations .pdf
QUESTION 1A business system is a(n)A.collection of operations .pdfQUESTION 1A business system is a(n)A.collection of operations .pdf
QUESTION 1A business system is a(n)A.collection of operations .pdffeelinggifts
 
Please comment for these two separate answers.These two separate a.pdf
Please comment for these two separate answers.These two separate a.pdfPlease comment for these two separate answers.These two separate a.pdf
Please comment for these two separate answers.These two separate a.pdffeelinggifts
 
Need help with questions 2-4. Write assembly code to find absolute v.pdf
Need help with questions 2-4. Write assembly code to find absolute v.pdfNeed help with questions 2-4. Write assembly code to find absolute v.pdf
Need help with questions 2-4. Write assembly code to find absolute v.pdffeelinggifts
 
MATLAB CODE Write a function with the header which calculates the p.pdf
MATLAB CODE Write a function with the header which calculates the p.pdfMATLAB CODE Write a function with the header which calculates the p.pdf
MATLAB CODE Write a function with the header which calculates the p.pdffeelinggifts
 
Merge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdfMerge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdffeelinggifts
 
Introduction You implemented a Deck class in Activity 2. This cla.pdf
Introduction You implemented a Deck class in Activity 2. This cla.pdfIntroduction You implemented a Deck class in Activity 2. This cla.pdf
Introduction You implemented a Deck class in Activity 2. This cla.pdffeelinggifts
 
In the Hackensack river estuary wich crosses the Meadowlands, the sa.pdf
In the Hackensack river estuary wich crosses the Meadowlands, the sa.pdfIn the Hackensack river estuary wich crosses the Meadowlands, the sa.pdf
In the Hackensack river estuary wich crosses the Meadowlands, the sa.pdffeelinggifts
 
in javaIn Java, integer division is performed using the operato.pdf
in javaIn Java, integer division is performed using the  operato.pdfin javaIn Java, integer division is performed using the  operato.pdf
in javaIn Java, integer division is performed using the operato.pdffeelinggifts
 
Identify the balance sheet components of a commercial bank.Solut.pdf
Identify the balance sheet components of a commercial bank.Solut.pdfIdentify the balance sheet components of a commercial bank.Solut.pdf
Identify the balance sheet components of a commercial bank.Solut.pdffeelinggifts
 

More from feelinggifts (20)

Which of the following is not a function of interest groups A. to i.pdf
Which of the following is not a function of interest groups A. to i.pdfWhich of the following is not a function of interest groups A. to i.pdf
Which of the following is not a function of interest groups A. to i.pdf
 
When explaining civil law one would say that it is concemed with disp.pdf
When explaining civil law one would say that it is concemed with disp.pdfWhen explaining civil law one would say that it is concemed with disp.pdf
When explaining civil law one would say that it is concemed with disp.pdf
 
What is the difference between a short and long branchSolution.pdf
What is the difference between a short and long branchSolution.pdfWhat is the difference between a short and long branchSolution.pdf
What is the difference between a short and long branchSolution.pdf
 
What is the maximum file size in a FAT32 systemSolutionFirst .pdf
What is the maximum file size in a FAT32 systemSolutionFirst .pdfWhat is the maximum file size in a FAT32 systemSolutionFirst .pdf
What is the maximum file size in a FAT32 systemSolutionFirst .pdf
 
View transaction list Journal entry worksheet The company paid $510 c.pdf
View transaction list Journal entry worksheet The company paid $510 c.pdfView transaction list Journal entry worksheet The company paid $510 c.pdf
View transaction list Journal entry worksheet The company paid $510 c.pdf
 
The numeric data types in C++ can be broken into two general categori.pdf
The numeric data types in C++ can be broken into two general categori.pdfThe numeric data types in C++ can be broken into two general categori.pdf
The numeric data types in C++ can be broken into two general categori.pdf
 
The capillaries at the alveoli Form a respiratory membrane Are spe.pdf
The capillaries at the alveoli  Form a respiratory membrane  Are spe.pdfThe capillaries at the alveoli  Form a respiratory membrane  Are spe.pdf
The capillaries at the alveoli Form a respiratory membrane Are spe.pdf
 
Select the word or phrase which best matches the description of it..pdf
Select the word or phrase which best matches the description of it..pdfSelect the word or phrase which best matches the description of it..pdf
Select the word or phrase which best matches the description of it..pdf
 
Robin Hood has hired you as his new Strategic Consultant to help him.pdf
Robin Hood has hired you as his new Strategic Consultant to help him.pdfRobin Hood has hired you as his new Strategic Consultant to help him.pdf
Robin Hood has hired you as his new Strategic Consultant to help him.pdf
 
Research indicates that online news seekers tend to access topics of.pdf
Research indicates that online news seekers tend to access topics of.pdfResearch indicates that online news seekers tend to access topics of.pdf
Research indicates that online news seekers tend to access topics of.pdf
 
Read Case Study Room 406 and answer the following questions in 2.pdf
Read Case Study Room 406 and answer the following questions in 2.pdfRead Case Study Room 406 and answer the following questions in 2.pdf
Read Case Study Room 406 and answer the following questions in 2.pdf
 
QUESTION 1A business system is a(n)A.collection of operations .pdf
QUESTION 1A business system is a(n)A.collection of operations .pdfQUESTION 1A business system is a(n)A.collection of operations .pdf
QUESTION 1A business system is a(n)A.collection of operations .pdf
 
Please comment for these two separate answers.These two separate a.pdf
Please comment for these two separate answers.These two separate a.pdfPlease comment for these two separate answers.These two separate a.pdf
Please comment for these two separate answers.These two separate a.pdf
 
Need help with questions 2-4. Write assembly code to find absolute v.pdf
Need help with questions 2-4. Write assembly code to find absolute v.pdfNeed help with questions 2-4. Write assembly code to find absolute v.pdf
Need help with questions 2-4. Write assembly code to find absolute v.pdf
 
MATLAB CODE Write a function with the header which calculates the p.pdf
MATLAB CODE Write a function with the header which calculates the p.pdfMATLAB CODE Write a function with the header which calculates the p.pdf
MATLAB CODE Write a function with the header which calculates the p.pdf
 
Merge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdfMerge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdf
 
Introduction You implemented a Deck class in Activity 2. This cla.pdf
Introduction You implemented a Deck class in Activity 2. This cla.pdfIntroduction You implemented a Deck class in Activity 2. This cla.pdf
Introduction You implemented a Deck class in Activity 2. This cla.pdf
 
In the Hackensack river estuary wich crosses the Meadowlands, the sa.pdf
In the Hackensack river estuary wich crosses the Meadowlands, the sa.pdfIn the Hackensack river estuary wich crosses the Meadowlands, the sa.pdf
In the Hackensack river estuary wich crosses the Meadowlands, the sa.pdf
 
in javaIn Java, integer division is performed using the operato.pdf
in javaIn Java, integer division is performed using the  operato.pdfin javaIn Java, integer division is performed using the  operato.pdf
in javaIn Java, integer division is performed using the operato.pdf
 
Identify the balance sheet components of a commercial bank.Solut.pdf
Identify the balance sheet components of a commercial bank.Solut.pdfIdentify the balance sheet components of a commercial bank.Solut.pdf
Identify the balance sheet components of a commercial bank.Solut.pdf
 

Recently uploaded

FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 

Recently uploaded (20)

FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 

You’re helping a group of ethnographers analyze some oral history da.pdf

  • 1. 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 those interviews, they’ve learned about a set of n people (all of them now deceased), whom we’ll denote P1, P2, . . . , Pn. They’ve also collected facts about when these people lived relative to one another. Each fact has one of the two following forms: • Person Pi died before person Pj was born. • The life spans of Pi and Pj overlapped at least partially. (Here Pi and Pj are two specific people whom the fact is about.) 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 algorithm with polynomial running time 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. Solution Algorithm: 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
  • 2. 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