C代写:CS162-Hashtag

Introduction

In Lab 1 “Rock Climber”, you learned how to climb rocks (well, sort of). You got overly excited and couldn’t wait to tell your friends about your newly acquired skill on Twitter. Obviously, you needed an excellent hashtag for your tweet. No problem! We will find you one.

In this request, you will be exposed to several array searching and sorting concepts and implementations, and asymptotic analyses in general. Work individually. Follow the guidelines in the syllabus for any discussions with others. You may work in pairs on extra credit contests, but then the extra credit will be divided among the two of you. Extra credit entries must be bug free to be eligible and turned in on time (no late days).

Files

After downloading the request tarball from the course website, extract the files by running:

1
tar -xvf lab2-handout.tgz

from a terminal window. Some of the files worth looking at are listed below.
Files you won’t modify:

1
2
3
4
Makefile
lib/*.h
lib/*.c
lib/words

Files you may modify (and the files denoted by * will be submitted for grading):

1
2
3
4
5
6
* duplicates.c
* trending.c
* validity.c
duplicates_test.c
trending_test.c
validity_test.c

Additionally, you should create a file called:

1
written.pdf

which contains the answers to the written parts of the request. For your convenience, we’ve provided a LATEX template (written.tex).

Submission

To submit your programming request, first generate a handin archive lab2-handin.tgz with the command

1
make package

then submit your lab2-handin.tgz file to your Subversion repository (svn) for the class. Once you’ve completed all problems, you should also submit your written.pdf to Gradescope.

Note that your code will not be graded until after the due date. It is your responsibility to test your code and proofread your writeup thoroughly before submitting.

Hashtag

What is a hashtag you ask? Well, it is “a word or phrase preceded by the symbol # that classifies or categorizes the accompanying text (such as a tweet)”. For the purpose of this lab, we will ignore the preceding “#” sign, because they appear in front of every hashtag. Furthermore, throughout the lab, we will assume that the hashtags are case-insensitive. For example, #OhWhatABeautifulMorning is represented as the string “ohwhatabeautifulmorning”, or more precisely, a char array in C, of course.

WhatHashtagsHaveIUsed

In this part of the request, given a sorted array of hashtags (i.e. an array of strings sorted in alphabetical order) that you have used since your first tweet, you will return a new sorted array of distinct hashtags. In other words, the new array should contain the same strings as the original array, but all strings are now distinct.