subject

Your backend for the the social network site, FriendWork, is not working very well. You need to improve it to help support it’s growing customer base. The updated backend will need to support the same functionality as the first, such as adding, removing, and printing friendships. However, this time the the updates such as add and remove will need to be done with more efficient functions/data structures. Remember that friendships go both ways, i. e. if A is friends with B, then B is also friends with A. Input Specification The input will begin with an integer q (q ≤ 500,000), number of queries to your webpage. The next q lines will each contain 1 server query. There are 3 query types. The first query type is the add query. The add query will begin with the word "ADD" followed by two names, a and b. The word "ADD" and the names will all be separated by a single space. This query implies the people named a and b have become friends. The second query is the remove query. The remove query will begin with the word "REMOVE" followed by two names, a and b. The word "REMOVE" and the two names will be separated by a single space. The remove query will denote that user a and b are no longer friends. The last query type is the list query. The list query will begin with the word "LIST" followed by one name, a, representing the user we wish to list the friends of. Each name will be at most 100 lower case characters and will contain no whitespace. No user will become a friend of themselves. No user will remove themselves as a friend. If a friendship is added, it will be between two users that are currently not friends. If a friendship is removed, it will be between two users that are currently friends. Output Specification For each list query print out on a line by itself the number of friends the user has. After which print out the names of each friend of the given user (in any order) each on their own line. Input Output Example Input Output 5 ADD alice bob ADD alice carol LIST alice LIST david REMOVE alice bob 2 bob carol 0 6 LIST alice ADD alice bob ADD alice david LIST alice ADD david bob LIST david 0 2 bob david 2 alice bob Explanation Please refer to the original document for assignment 1 Advice Two solutions to this problem both use BSTs. The first possibly easier to conceptualize solution uses 2 structs. A user_bst struct and a friend_bst struct. The BST is needed for both of them, because removing a user from someones friend list would be slow without a BST. Each node of the user BST would point to the root of a friend BST that stores all the friends the given user has. The other solution approach uses one BST node to store both the user and the friend BST. This makes it so there is less functions to create (and debug). However, there will be a slight memory overhead thanks to the extra pointers

program in C please

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:10
Which activity should be part of a long-term plan to positively affect yourhealth? oa. wearing regular clothing when handling toxinsob. not worrying about secondhand smokeoc. avoiding excessive exposure to sunlightod. drinking only well water
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
The basic work area of the computer is it screen that you when you first fire up your computer
Answers: 1
question
Computers and Technology, 24.06.2019 09:40
Healthy study habits are best described as
Answers: 1
You know the right answer?
Your backend for the the social network site, FriendWork, is not working very well. You need to impr...
Questions
question
Mathematics, 03.12.2019 07:31
Questions on the website: 13722367