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 22:30
The qwerty keyboard is the most common layout of keys on a keyboard
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
Creating "smart interfaces" in all sectors of industry, government, and the public arena is one of the fastest growing hct areas. these interfaces model, interpret, and analyze such human characteristics as speech, gesture, and vision. the field of biometrics, in which humans authenticate themselves to machines, is an area of considerable interest to hct practitioners. fingerprint scans are one of the most frequently used biometric options, and this article, biometric student identification: practical solutions for accountability & security in schools, makes a case for the implementation of fingerprint scans in schools. critique the article, and answer the following questions: according to the author, what are the main benefits of adopting fingerprint scans in schools for student identification? according to the author, what are the main drawbacks of adopting fingerprint scans in schools for student identification? do you agree with the author's assessment of the pl
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
question
Computers and Technology, 23.06.2019 20:40
Instruction active describing list features which statements accurately describe the features of word that are used to create lists? check all that apply. the tab key can be used to create a sublist. the enter key can be used to add an item to a list. the numbering feature allows for the use of letters in a list. the numbering feature can change the numbers to bullets in a list. the multilevel list feature provides options for different levels in a list.
Answers: 2
You know the right answer?
Your backend for the the social network site, FriendWork, is not working very well. You need to impr...
Questions