forked from fxwalsh/algorithms-2016
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
60 additions
and
66 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Submodule public-site
updated
from 583e9a to 0aef3c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## Data | ||
|
||
You are provided with the following weighed data adapted from [Wiktionary](file//:wiktionary.txt). The file contains the 10,000 most common words along with weights equal to their frequencies. You will have to write your own code that can parse the data. There is one term per line, with the weight and term separated by a tab. The terms can be arbitrary strings consisting of Unicode characters, including spaces (but not newlines). | ||
|
||
The following code example, contained in the [class resources repo](https://github.com/fxwalsh/algorithms-2016-examples.git), uses the Scanner class to read in a text file line by line, parse the data, and print the data to the standard output: | ||
|
||
~~~ java | ||
File usersFile = new File("./data/userdata.txt"); | ||
Scanner inUsers = new Scanner(usersFile); | ||
String delims = "[ ]";//each field in the file is separated(delimited) by a space. | ||
while (inUsers.hasNextLine()) { | ||
// get user and rating from data source | ||
String userDetails = inUsers.nextLine(); | ||
// parse user details string | ||
String[] userTokens = userDetails.split(delims); | ||
|
||
// output user data to console. | ||
if (userTokens.length == 2) { | ||
System.out.println("UserID: " + userTokens[0] + ",First Name:" + userTokens[1]); | ||
|
||
}else | ||
{ | ||
inUsers.close(); | ||
throw new Exception("Invalid member length: "+userTokens.length); | ||
} | ||
} | ||
inUsers.close(); | ||
~~~ | ||
|
||
The above code produces output similar to the following: | ||
|
||
>UserID: 1,First Name:bob | ||
>UserID: 2,First Name:jack | ||
>UserID: 3,First Name:donald | ||
>UserID: 4,First Name:mary | ||
|
||
You will also need to design and implement a suitable data type(s) that will support the functionality of the program. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
##Testing | ||
|
||
Approximately 20% of marks in this assignment is for the testing and test strategy. You are required to provide the following: | ||
|
||
- Write a test specification for each class you test (at least 2 classes). The test strategy should be contained in the readme.md of your Github repository. | ||
- JUnit test cases + a series of tests. | ||
- For each tests you write - indicate which part of the specification you are testing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes.