代写Algorithm | 代写Java – 这是一个java的基础的project题目
CSC B07 Assignment0
This assignment has two questions. You must complete both the questions correctly.
You are first required to checkout Assignment0 starter code from your SVN repository.
a) Your SVN repository location is of the following form:
https://markus.utsc.utoronto.ca/svn/cscb07f18/YOURUTORID/
where you must replaced YOURUTORID with your actual UTORID
b) You are free to use any IDE that you wish.
c) If you plan on using Eclipse, then there is a short tutorial I have posted on Blackboard under Assignments folder that may be useful in explaining how to checkout the projectusing Eclipse and Subclipse (SVN client that integrates with Eclipse as a Eclipse Plugin). The link to the tutorial is reproduced here as well: http://goo.gl/tL4uYC
Optional: If you like to work on the command line, and like to check out assignment0 on mathlabmachines on UTSC, then this video of mine will help you on how to checkout your assignment0 on mathlab machine using command line and compile/execute using command line on the mathlab machine.
https://www.youtube.com/watch?v=Y7i4QB959PQ
d) The last revision that is present in your SVN repository at time of due date; will be used for grading. We will not mark any previous revisions. You must make sure that the last revision is compilable and that we can execute it correctly.
e) Once you have checked out your project, you will notice that there are three javafiles.
- Cfiltering.java
- CfilteringDriver.java 3)Rearranging.java
You will use these files to write your code.
Note: Without making any change to the code that you have just checked out. You should be able to compile and run your code as it is and be able to generate the following output: (input1.txt is also on your SVN server and is checked out as well if you follow the steps correctly on the slides posted under Assignment0 module on Quercus. The above screenshot is of running the file CfilteringDriver.java using the input1.txt file) The output is of the starter code without any modification to the starter code.
Question 1)
For this question you will be working on Rearranging.java file that you got from the repository.
Suppose that there is an array and let us call this array, items. This array of items contains n integers. These n integers are in a complete random order in the array. What you are asked to do is to rearrange the items in the array such that all the negative integers come before all the zeros and all the positive integers appear at the end.
Note, this question is not asking you to sort the numbers in the array. It is asking you to rearrange them. Here are some examples, to help you understand the problem.
Example 1:
In this first example, you can see that the array initially contains the integers 7, -3, 0, 0, 8 and -2. Now this is in random order. What you must do to this array, is to rearrange the numbers such that the array has three distinct pieces (also called constraints) represented by <0, ==0 and >0. You can see that in the first region, we place all the numbers that are less than 0, followed by all zeros and then followed by any numbers that are greater than 0.
The numbers within each region can be in any order, as long as they happen to fulfill the constraint.
Here is another example:
Example 2:
I have provided you starter code for this, please make sure to first understand the starter code, and then complete the methods as mentioned in the starter code. And also make sure that your Algorithmruns in linear time. Your loopcan only run once through the array, and you cannot call any sorting functions to sort the entire array.
Do not create any new array, but you must use mutate the original array so that you can rearrange the items in the original array itself.
Question 2) For this question, you will be working on the files Cfiltering.java and CfilteringDriver.java
Part 1)
ONLY PROCEED WITH PART2 of this question, IF YOU HAVE THE OUTPUT AS SEEN IN PART1 (see the figure below). You can produce this output by running your Java program using Eclipse (i.e, make sure to run CfilteringDriver.java ).
Part 2) Sites such as Amazon and Ebay, track-purchasing history of its users and shoppers. When the user logs in, these sites use the information to suggest products that may be of interest to you. Amazon for instance can recommend movies you might like, even if you have purchased books or music from it before.
The data by these sites can be mined in very different ways. Data can be (I like / I dislike), (yes/ no) vote, or as ratings (1 to 5) etc. On the other hand, dating websites try to match up people based on how similar they are. If Jack and Jill have similar interests, Jack may get a recommendation on his profile page Hi Jack, Jill has similar interests as you, do you like to send her a message OR add her as friend?
For this assignment i.e. assignment0 the input file will be of the following format: (Please do not deviate from this format). Note there are line break , new line , and spaces. 4 5
2 3 4 1 1 5 4 2 5 4 4 5 3 1 3 1 1 1 5 5
Where 4 on the first line represents the number of users and 5 on the second line represents the number of movies. The matrix that is followed is a #user x #movie (4×5) matrix. Where rows= #of users=4 and columns= #of movies=5.
The first row of (2 3 4 1 1) means that user1 has rated : (movie1,movie2,movie3,movie4,movie5) as (2,3,4,1,1).
Likewise second row of 5,4,2,5,4 means that user2 has rated: (movie1,movie2,movie3,movie4,movie5) as (5,4,2,5,4).
Your job is to find a similarity score between pair of users that tells how similar they are i.e. Are user1 and user2 more similar based on their rating of movies OR are user3 and user1 more similar? etc.
You can safely assume:
- Number of users will be between: 3 # of users 9
-
Number of movies will be between: 3 # of movies 9.
-
Rating of movies will be in the range: 1 rating 5
Euclidean Distance Score (How to calculate similarity score?):
The basic idea behind Euclidean distance score is to calculate distance between any two points. For example, the two points are as follows:
- Point1 (x,y)= (1,1)
- Point2 (x,y)=(3,1)
What is the distance between the above two points?