Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

create a representation of your network with friends. For that purpose, for the sake of simplicity, use a list collection. Create everyone as a person

create a representation of your network with friends. For that
purpose, for the sake of simplicity, use a list collection. Create everyone as a person where each
person has unique identifier (SSN ) Create a person with a name, surname, and
this unique identifier. For example:
Person ali = new Person(Ali,Korkmaz,769);
Person ayse = new Person(Aye,Korkmaz,476);
Person murat = new Person(Murat,Korkmaz,413);
Person nilay = new Person(Nilay,Korkmaz,823);
Person deniz = new Person(Deniz,Erdeniz,511);
Person emre = new Person(Emre,Yorulmaz,670);
...
Use a proper data structure (and Java collection) for keeping relations:
(769,476),(476,413),(476,823),(670,823),(670,769)
When we want to see all the people a person is connected, for example for Aye Korkmaz 476,
it must find all the connected people and must show them once:
476 is connected to 769 and 413 and 823; 769 is connected to 476 and 670; 413 is connected to
476; 823 is connected to 476 and 670; ...
Therefore, 476(Aye Korkmaz) is connected to 769(Ali Korkmaz),413(Murat Korkmaz),823
(Nilay Korkmaz), and also 476 is connected to 670(Emre Yorulmaz) since Emre Yorulmaz is
connected to 769(Ali Korkmaz) and Ali Korkmaz is connected to 476(Aye Korkmaz).
So, all the people whom Aye Korkmaz connected are 768,413,823,670.
If we want to find whom Aye Korkmaz not connected, then we have 511(Deniz Erdeniz)
Create 15 people and demonstrate the functionality of your code. Ensure your code is readable,
understandable, and sufficiently commented. Your code should be compiled and run without
errors (better you handle exceptions). use List, Stack, Queue, Priority Queue, Set, and Map.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions