Skip to content

CodersSquad/ds-sum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Iterative, Recursive and Direct Functions and their Complexity Analysis

On this excersice you will write a program that will implement 3 ways of doing a sumation.

  • Iterative sumation
  • Recursive sumation
  • Direct sumation

Requirements

All functionalities must be correctly aligned and documented (in code). As part of the documentation, the complexity of each of them must be included.

Function's name and definition

  • int interativeSum(int n)
  • int recursiveSum(int n)
  • int directSum(int n)

Work in the sum.cpp file

You must add each function's execution time measurement, make sure to report the result and the execution time in the following format:

# Iterative Sum with n = 3
  - Result: 6
  - Execution time: 0.0001 seconds
# Recursive Sum with n = 3
  - Result: 6
  - Execution time: 0.0701 secons
# Direct Sum with n = 3
  - Result: 6
  - Execution time: 0.041 secons

How you program should compiled and tested

Compilation

make

Tests

make test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published