0% found this document useful (0 votes)
31 views2 pages

Assignment 1

The document outlines Assignment 1 for CSC 2302, Data Structures, due on October 02, 2021. It consists of three exercises: creating a function to calculate elapsed time between two time structures, writing a recursive program to count the digits of an integer, and proving a conjecture related to asymptotically positive functions. Each exercise includes examples to illustrate the expected input and output.

Uploaded by

Wissale Kabil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

Assignment 1

The document outlines Assignment 1 for CSC 2302, Data Structures, due on October 02, 2021. It consists of three exercises: creating a function to calculate elapsed time between two time structures, writing a recursive program to count the digits of an integer, and proving a conjecture related to asymptotically positive functions. Each exercise includes examples to illustrate the expected input and output.

Uploaded by

Wissale Kabil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CSC 2302, Data Structures- Fall 2021

Assignment 1(Due October 02)


Exercise 1:
Write a program embedding a function called elapsedTime with two parameters,
the start time and the end time. Each parameter is a structure of type time with
three fields: the hours, minutes and seconds of a specific time.
The function is to return a time structure containing the time elapsed between the
two parameters.
You must handle the situation when the start time is in the previous day.
Examples:
Input: 15h 23mn 45s Input: 15h 23mn 45s
10h 10mn 30s 10h 50mn 30s
Output: 5h 13mn 15s Output: 4h 33mn 15s

Input: 15h 23mn 45s Input: 1h 23mn 45s


10h 10mn 50s 10h 10mn 30s
Output: 5h 14mn 55s Output: 15h 13mn 15s

Exercise 2:
Using the recursive approach, write a complete program that prompts the user to
enter an integer and prints the number of its digits.
Example: If the input n = 3159, then the output should be 4
Exercise 3:
Let and be asymptotically positive functions. Prove the following

conjecture:

You might also like