raft-key-value-store / labs-fall23-AnurimaVaishnavi-master / assignment1-1
README.md

Assignment 1 (Part 1): Intro to Go

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 you're starting from nothing, we highly recommend going through the Golang tour before you begin this assignment.

Software

You will find the code in the same directory as this readme. 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 punctuation should be removed. You can find more details on what qualifies as a word in the comments in the code.

You might find a helper function at the end of q1.go helpful.

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 mod init a1-1 # you should've done this by following ``Programming Assignments Setup''
  $ go test

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

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

Point Distribution

TestPoints
Q1Simple4
Q1DeclarationOfIndependence4
Q2_13
Q2_23
Q2_33
Q2_43

Submitting Assignment

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

$ git commit -am "[you fill me in]"
$ git tag -a -m "i finished assignment 1-1" a11-handin
$ git push origin master
$ git push origin a11-handin

Make sure you have let us know your github username (check out "To-Do List" on Piazza), so we can link your Github username to your UBITname for assignment grading.

Submit your assignment on Autolab (https://autograder.cse.buffalo.edu/). Sign in with your MyUB, select CSE486/586 Distributed Systems (f23), assignment1-1, enter the commit tag, e.g., a11-handin, check the academic integrity box, and submit.

Allow the page to load, which may take a few minutes. The points you earned and test details will be shown in the result.

You could submit multiple times, and only the last submission will count.

In case you need to overwrite a tag, e.g., point the tag to a more recent commit, use the force flag command as follows.

$ git tag -fam "i finished assignment 1-1" a11-handin
$ git push -f --tags