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, 23.06.2019 18:30
Janice recently received her college degree and is looking for a job. she is worried that since she just finished school, she will be required to repay her perkins and direct subsidized loans immediately. janice pulls out the paperwork she signed and reviews it again for repayment information. after reading all of the information, janice discovers that
Answers: 2
question
Computers and Technology, 24.06.2019 00:50
3. what is the output of the following statements? temporary object1; temporary object2("rectangle", 8.5, 5); temporary object3("circle", 6, 0); temporary object4("cylinder", 6, 3.5); cout < < fixed < < showpoint < < setprecision(2); object1.print(); object2.print(); object3.print(); object4.print(); object1.set("sphere", 4.5, 0); object1.print();
Answers: 1
question
Computers and Technology, 24.06.2019 11:20
Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. which device transmits frequencies to mobile phones? towers transmit frequencies to mobile phones.
Answers: 1
question
Computers and Technology, 24.06.2019 19:20
Kiesha has a worksheet with a range of cells using the following columns: name, score, group, study group, and date. kiesha needs to sort the worksheet on the date field. which option she use to most efficiently complete this task ? a use the cut and paste option to reorganize the data to fit that order b use the filter function to organize the data based on the date c use the order function to organize the data based on the date d use the sort function to organize the data based on date order
Answers: 3
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, 31.03.2021 05:20
Questions on the website: 13722360