Question: NOTE: I know there's already another Chegg post with an answer for this question, but please don't re-submit that same answer as it's an incorrect
NOTE: I know there's already another Chegg post with an "answer" for this question, but please don't re-submit that same answer as it's an incorrect and incomplete solution. That's why I'm posting a new one.

In this assignment, you will develop a C program of micro-version of Facebook using Hash Tables and Linked Lists. Specifically, your program will accept from input a sequence of commands of the following forms, one command to a line, such as: . (name) - Create a person record of the specified first name. You may assume that no two people have the same first name. F (namel) (name2) Record that the two specified people are friends. .U (namel) (name2) Record that the two specified people are no longer friends. L (name) Print out the friends of the specified person. O(namel) (name2) Check whether the two people are friends. If so, print "Yes"; if not, print "No" X - terminate the program. For instance, this is one possible input and output: Output Input P Sam P Liza P Mark P Amy F Liza Amy F Liza Mark F Amy Sam L Amy L Sam U Liza Amy L Amy O Liza Mark X Liza Sam Amy Sam Yes . Try to make the program as efficient as possible. An efficient algorithm should satisfy the following: The command "L" should take time proportional to the number of friends that the person has. The command "U" should execute in time proportional to the sum of the friends that the two named people have. The commands "P", "F", and "Q" should execute in a constant time. But this is not required All these commands should execute in time that is independent of the total number of people in the system. In this assignment, you will develop a C program of micro-version of Facebook using Hash Tables and Linked Lists. Specifically, your program will accept from input a sequence of commands of the following forms, one command to a line, such as: . (name) - Create a person record of the specified first name. You may assume that no two people have the same first name. F (namel) (name2) Record that the two specified people are friends. .U (namel) (name2) Record that the two specified people are no longer friends. L (name) Print out the friends of the specified person. O(namel) (name2) Check whether the two people are friends. If so, print "Yes"; if not, print "No" X - terminate the program. For instance, this is one possible input and output: Output Input P Sam P Liza P Mark P Amy F Liza Amy F Liza Mark F Amy Sam L Amy L Sam U Liza Amy L Amy O Liza Mark X Liza Sam Amy Sam Yes . Try to make the program as efficient as possible. An efficient algorithm should satisfy the following: The command "L" should take time proportional to the number of friends that the person has. The command "U" should execute in time proportional to the sum of the friends that the two named people have. The commands "P", "F", and "Q" should execute in a constant time. But this is not required All these commands should execute in time that is independent of the total number of people in the system
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
