Solve the question and make a coding.
Send me info at [url removed, login to view]
I will award to you if the answer is right and good.
Social Graph Question
In this problem, we want to parse a member's social graph on the hot new social network. For the unfamiliar, each member in the network has n-many friends. Each of those friends has n-many more friends and on and on and on. We would like you to write a program that given a social graph, outputs each level of friends. Each friend should only be output once, at the first level they are encountered. The root friend should not be output. Input will be provided as an array of strings where each element represents a member and their friends. The final element of the array will be the student of whom we will begin our traversal.
For instance, a member and their friends will be represented as the string:
where "A" is the member and "B", "C", and "D" are friends of "A". If a member is listed without a colon, you can assume they have no friends of their own.
You will provide your output as an array of strings where each element is a comma-delimited string of friends on that level.
For instance, if the input is:
This means that we are going to return:
For a more complex example, if the input is:
["A:B,C,D", "B:A,D,E", "C:E,B", "A"]
The output will be:
"A" is the root element, so we start there. A has "B", "C", and "D" as friends, so that is the first level of our friend network. "B" has "A", "D" and "E" as their network, while "C" has "E" and "B". "D" is not listed so we can assume there are no friends of "D". If we put all the friends of this second level together we have "A", "D", "E" (from B) and "B", "D" and "E"(from C). Because "A" is where we started, we do not include "A". Because we already saw "B" and "D" in the first level, we do not include "B" or "D". And because we have two instances of "E", we only display one at a time, giving us only "E" for our second level friends.
Vector Graphics Question
Let's say we're developing a vector graphics application. It will allow the user to create lines, rectangles, circles, text, etc. and manipulate them independently - move them, re-size them, etc. Design an object model for this application.
How would you model the representation of the document in an object oriented language?
What classes would you define?
What methods would you have? What would your API look like?
Please note that we expect to see class and/or interface definitions with method stubs. We do not want a description nor do we want implementation, simply the classes involved and how they will interact and extend with each other.