Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose we want to create an address book which contains names, phone numbers, e

ID: 3828154 • Letter: S

Question

Suppose we want to create an address book which contains names, phone numbers, emails, and other personal information. In the questions below, give support to your answers based on the typical operations (for example, finding a person by his/her email) you might use. Explain why the algorithm and/or data structure you use gives a good tradeoff between memory use and runtime complexity. Some of the questions below could require nested data structures (for example, a Map which has values that are Sets).

a) Which data structures should you use for the address book in general to store the class Person? Give reasoning for your answer.

b) Suppose you have friends who live in various different cities. What data structure could be useful to find these friends efficiently. You can suppose that each friend has a city field associated with them. Give reasoning to your answer. Think about search engines for this question.

c) Suppose you want to check that there are no people with the same email address. Which algorithm(s)/data structure(s) might you use to do this? Give reasoning for your answer.

d) Suppose in you know which of the people in you address book are friends which each other. Now suppose you take yourself out of the graph. Which algorithm(s)/data structure(s) would help you determine the number of unrelated groups of friends you have? Give reasoning for your answer.

e) Suppose you want to list your friends who have March birthdays in order of date. What algorithm(s)/data structure(s) whould you use to accomplish this. You may assume that you have a birthday field which has a Date class that contains date and month member variables. Declare any other assumptions you make and give reasoning for your answer.

Explanation / Answer

Where the we want to support to create an address book or etc personal information it can be mainly in the using Data structures are the most efficient and real kind of constructions which are used for retrieving and repossessing the data with the smallest reply time by means of primary key current in the file and finished which we can save the entire info of that data.

a) We determination usage of the "Hash Map" as a data structure for the address book to store the class person as hash map uses two things:1. Key 2. Value With the help of key, we can effortlessly store and access the value in address book.

b) We determination use "Relational DBMS" as a structure by making a table which contains of tuples friend’s id, friend city etc. and by making a query and stipulating the disorder of city like where city= "xyz";

and through this we can easily retrieve the names of friends living in that specific city.

c) We will use "Select distinct" statement in relational dbms which gives distinct values of that attribute and by by means of the key corresponding to that particular worth we can check whether two persons have same email id or not.

e) Meanwhile we want to distinguish the list of friends’ whose birthday lies in March in terms of order by date so we will use the data structure called as sql query by specifying that:

select friend's name from friend's

where friend. birth month="march" and order by birthdate;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote