[Solved] COS418 Assignment 1 (Part 1): Intro to Go

$25

File Name: COS418_Assignment_1_(Part_1):_Intro_to_Go.zip
File Size: 386.22 KB

SKU: [Solved] COS418 Assignment 1 (Part 1): Intro to Go Category: Tag:
5/5 - (1 vote)

Introduction

In this assignment you will solve two short problems as a way to familiarize yourself with the Go programming language. We expect you to already have a basic knowledge of the language. If youre starting from nothing, we highly recommend going through the Golang tour before you begin this assignment. Get started by installing Go on your machine.

Software

You will find the code the same directory. The two problems that you need to solve are in q1.go and q2.go. You should only add code to places that say TODO: implement me. Do not change any of the function signatures as our testing framework uses them.

Q1 Top K words: The task is to find the K most common words in a given document. To exclude common words such as a and the, the user of your program should be able to specify the minimum character threshold for a word. Word matching is case insensitive and punctuations should be removed. You can find more details on what qualifies as a word in the comments in the code.

Q2 Parallel sum: The task is to implement a function that sums a list of numbers in a file in parallel. For this problem you are required to use goroutines (the go keyword) and channels to pass messages across the goroutines. While it is possible to just sum all the numbers sequentially, the point of this problem is to familiarize yourself with the synchronization mechanisms in Go.

Testing

Our grading uses the tests in q1_test.go and q2_test.go provided to you. To test the correctness of your code, run the following:

  $ cd assignment1-1  $ go test

If all tests pass, you should see the following output:

  $ go test  PASS  ok      /path/to/assignment1-1   0.009s

Submitting Assignment

Now you need to submit your assignment. Commit your change and push it to the remote repository by doing the following:

4.7/5 – (3 votes)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COS418 Assignment 1 (Part 1): Intro to Go
$25