Consider a digital personal assistant similar to Alexa and Siri that could manage your schedule. How would you design a tool such that it can efficiently find events during a certain period of time (without the speech recognition/generation component)?

The goal of HW5 is to allow the user to specify a time range to get the corresponding events. Also, we would like the user to be able to add and cancel events as the user's schedule changes. To improve efficiency, your implementation uses a Skip List that has at least the following operations:

  • get(k)
  • put(k, v)
  • remove(k)
  • subMap(k1, k2)

Use getRandHeight() in fakeRandHeight.c (FakeRandomHeight.java in java) for put(key, value) (to facilitate eaiser debugging and testing) [gcc -o hw5 hw5.c fakeRandHeight.c]. You may rewrite/modify doublyLinkedList.c/h (DoublyLinkedList.java). Program files are on the course website. We will be evaluating your submission on code01.fit.edu; we strongly recommend you to ensure that your submission runs on code01.fit.edu.

Input: The command-line argument for hw5.c (HW5.java) is the name of a file, which has one of the following actions on each line:

  • AddEvent time event
  • CancelEvent time
  • GetEvent time
  • GetEventsBetweenTimes startTime endTime
  • GetEventsForOneDay date
  • GetEventsForTheRestOfTheDay currentTime
  • GetEventsFromEarlierInTheDay currentTime
  • PrintSkipList

For simplicity, time is an integer in MMDDHH format and date is in MMDD format (MM is 01-12, DD is 01-31, and HH is 00-23) [leading zeros are optional]. The timestamps are unique and each timestamp can only have at most one event. Sample input is on the course website.

Output: Output goes to the standard output (screen), each line has a result for the corresponding action:

  • AddEvent time event [ExistingEventError:existingEvent]
  • CancelEvent time event/NoEventError
  • GetEvent time event/none
  • GetEventsBetweenTimes startTime endTime time1:event1 ... or none
  • GetEventsForOneDay date time1:event1 ... or none
  • GetEventsForTheRestOfTheDay currentTime time1:event1 ... or none
  • GetEventsFromEarlierInTheDay currentTime time1:event1 ... or none
  • PrintSkipList
(Sh) empty
...
(S1) time1:event1 ...
(S0) time1:event1 ...
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.