10 views

Uploaded by Bea Ducao

EEE 13

- Data StructureLab 3-12-13(Final) 1
- Design And Analysis of Algorithms Lab
- Adjancey Matrix Graphs
- 15840_15840HW1ECE434
- Frontier Search
- DFS
- electronics-07-00418.pdf
- 942
- Cheat Sheet
- Artificial Intelligence
- Path Between Two Nodes of Tree
- CS6301-U5
- Discrete Mathematics
- ADS-LAB MANUAL
- Ai LAB Final Record
- Mathematical biology
- Engineering Books.pdf
- Ramsey y
- 6th Grade Mathematics Curriculum Map
- 791405knouxh

You are on page 1of 2

Problem Statement:

You are in your dormitory, chilling and resting, when suddenly a friend contacts you. "Hey, I'm in EEE.

I need to finish this ME for EEE13 before 5:30PM. Help ASAP." As any good programmer, you refuse

to stand up for any work you can do sitting down, and you refuse to go to EEE if you can simply help

out from the comfort of your dormitory.

Of course you don't do the ME for him. You do the honest thing and simply guide your friend through

completing his work so far. However, you quickly find out that trying to explain how everything works

over facebook is inefficient, and you thought of the next obvious thing to do: hack into his computer and

give him an interactive tutorial session!

For whatever reason, his computer needs to be connected to your laptop through some series of

connections via ethernet cables. You asked your friend to figure out what are the direct connections

between computers, and he gives you info one at a time. Given the information that your friend has

provided so far, you need to figure out (a) whether your laptop and his computer are connected, and (b)

if it is connected, what is the fewest number of computers that you will need to go through.

For our problem, we can consider two computers A and B to be directly connected if there is an ethernet

cable connecting A and B directly. We also define two computers A and B to be connected when either

A and B are directly connected or when there is a computer C wherein A and C are connected and B and

C are connected (a recursive definition!).

Input Description:

The first line of the input contains two integers, N and Q. N denotes the number of computers that are in

the network we are considering. Each computer is denoted by an integer from 1 to N. Your friend's

computer is computer 1, while your laptop is computer N. Q denotes the number of queries that will

follow. Q lines will follow, each line denoting a query.

There are three types of queries, and they are indicated by the first integer in the line. Type 1 queries are

of the form "1 A B" and describes a direct connection between computers A and B. Type 2 and 3 queries

are described in the Output Description.

Output Description:

For each type 2 query, you must output "CONNECTED" in a single line if computers 1 and N are

connected, otherwise output "NOT CONNECTED". For each type 3 query, output the fewest number of

computers in between a path from 1 to N. Note that the count should not include computers 1 and N. If

there is no such path, output "INFINITY".

Sample Input:

39

2

3

112

2

123

2

3

113

3

Sample Output:

NOT CONNECTED

INFINITY

NOT CONNECTED

CONNECTED

1

0

Constraints:

Number of type 1 queries will not exceed N*(N-1)/2

Number of type 2 and 3 queries combined will not exceed 103

No type 1 query will denote a connection for two computers that already have a direct connection

Milestones

Type 1 and Type 2 queries must be working.

Week 2: Connectivity and Distance Checking (BFS)

Type 3 queries must also be implemented.

Grading Criteria:

10% - Interview

30% - DFS

- 10% for 1 <= N <= 10

- 10% for 1 <= N <= 103

- 10% for 1 <= N <= 105

60% - BFS

- 20% for 1 <= N <= 10

- 20% for 1 <= N <= 103

- 20% for 1 <= N <= 105

- Data StructureLab 3-12-13(Final) 1Uploaded byGowsalyatj
- Design And Analysis of Algorithms LabUploaded byRajendraYalaburgi
- Adjancey Matrix GraphsUploaded bynothingelse420
- 15840_15840HW1ECE434Uploaded byAmit Jaiswal
- Frontier SearchUploaded by.xml
- DFSUploaded byIsmail Naeem
- electronics-07-00418.pdfUploaded bybalasundar
- 942Uploaded bySayan Kumar Khan
- Cheat SheetUploaded bykanhaiyagupta20gmail
- Artificial IntelligenceUploaded bydondeg
- Path Between Two Nodes of TreeUploaded byHarikrishna Shenoy
- CS6301-U5Uploaded byrishikarthick
- Discrete MathematicsUploaded byAhmad Alhour
- ADS-LAB MANUALUploaded byRaghu Teja
- Ai LAB Final RecordUploaded byNagarjuna Reddy
- Mathematical biologyUploaded byqd45guj
- Engineering Books.pdfUploaded byOlsjon Baxhija
- Ramsey yUploaded byNanni Sumarni
- 6th Grade Mathematics Curriculum MapUploaded byguanajuato_christopher
- 791405knouxhUploaded byShashwat Tripathi
- UT Dallas Syllabus for cs5333.001.09f taught by Jorge Cobb (jcobb)Uploaded byUT Dallas Provost's Technology Group
- Java ProgmsUploaded byjv_priya93
- Timetable v 1.1 White UpdatedUploaded byRania Ahmed
- Tabel Kendal wUploaded byhardian
- action research project proposalUploaded byapi-245618390
- 12_redance1Uploaded byAlessandro Menichelli
- A New S-(a,d) Antimagic Labelling of a Class of Generalized Petersen GraphsUploaded byInternational Journal for Scientific Research and Development - IJSRD
- iit booksUploaded byshubham
- Division Long 1dd3dq Nr OldUploaded byctk2hood
- Fermat_I-2011Uploaded byBHAAJI0001

- ACAD CAL 2017-2018n2Uploaded byBea Ducao
- ACAD CAL 2017-2018n2Uploaded byBea Ducao
- How to Top the EE Board Exam 2015Uploaded byBenjack Mejor Alo
- C-32Uploaded byBea Ducao
- Human WeaponUploaded byBea Ducao
- MicroPMU Data Sheet 3.0Uploaded byBea Ducao
- 4-18notesperiod8Uploaded byGloria Taylor
- Lecture 5 v2Uploaded byBea Ducao
- lecture 1.pdfUploaded byBea Ducao
- Nd20lite ManualUploaded byBea Ducao
- Lecture 8(1)Uploaded byBea Ducao
- Lecture 8(1)Uploaded byBea Ducao
- Lecture 5.pdfUploaded byBea Ducao
- 07530210Uploaded byBea Ducao
- ACAD CAL 2017-2018.pdfUploaded byPortia Placino
- thestatusofarcheologyinthephilippines-120916051042-phpapp02Uploaded byBea Ducao
- 2016JLSSAppForm.pdfUploaded byAbigail Saballe
- DC2 Ducao Batad ClementeUploaded byBea Ducao
- Arkiyoloji ReportUploaded byBea Ducao
- Rectifier ProblemsUploaded byBea Ducao
- Problem Set Quantum Dead 19Uploaded byTidal Surges
- 6- Auxiliary ViewUploaded byapi-3815216
- Cagayan HandoutUploaded byBea Ducao
- SM_01_2008Uploaded byBea Ducao
- Practice Problems - Synch_MachinesUploaded byBea Ducao
- Lighting InteriorUploaded byBea Ducao
- 1 FDAS BasicsUploaded byBea Ducao
- Homework 20160712224505321Uploaded byBea Ducao
- Lecture 19 - Sample PlansUploaded byBea Ducao

- Genetic Exp 1 & 2Uploaded byYap Chinyeow
- Computer Software-PPT.pptUploaded bymarieta bandiala
- ZJ BrochureUploaded byibayraktar775208
- Know about Unique Device Identifier (UDI) | DDiUploaded byDDi
- 50 Muliple Choice Questions of Object Oriented ProgrammingUploaded bydevanabha
- 100616Uploaded byvol2no6
- Fundamentals of Beer and Hop ChemistryUploaded byRbn Sancho
- Foti Et Al-2017-Bulletin of Earthquake EngineeringUploaded bySantino
- eljuramentodedos01cast_djvuUploaded byGrimDesade
- WLZDTUploaded byAnonymous KqUKBXK
- Process Management Pain PointsUploaded byGC
- FlowCAD an Color VisibilityUploaded byphamvan_tuong
- Design of Machine ElementsUploaded byNeerav Saxena
- Delivering the Goods: Public Works Technologies, Management, and FinancingUploaded byChris Nash
- atomic theory modelsUploaded byapi-318918663
- Canon Ir105 BrochureUploaded byshamilbasayev
- Glidden - Response to Reimer - 2000Uploaded byLonnie
- EARTH BUILDING PERFORMANCE OPTIMIZATION WITH BIOPOLYMERSUploaded bySemana de Engenharia '2010
- Filter DesignUploaded byKarim Shahbaz
- Electronic TuckmanUploaded byAdelia Widiningrum
- portfolioUploaded byapi-238284715
- BSIT-33-Main-124-225-pgUploaded byKailly Bisht
- Population Policies - Case Study of IndiaUploaded byAnuja Sanghavi
- Transformation (Genetics) - Wikipedia, The Free EncycloTransformation (genetics)pediaUploaded byEmad Manni
- Math2allUploaded bysanjivsing
- NetBackup8_0_AdminGuide_EntVault1Uploaded byYemi Kolawole
- Guide 51Uploaded byPlinio Cabrera
- HTML+CSSUploaded byFazal Amin
- Modeling & SimulationUploaded bysnemo30
- OVM UVM MigrationUploaded bySagar Shah