0% found this document useful (0 votes)
24 views

1-Devising Algorithms - A

The document describes an assignment to determine the algorithm that produced sample output sequences for different values of the parameter N. Students are tasked with writing down the algorithm, running it for N=6, having a non-programmer friend run it for N=6, and reporting the output sequence.

Uploaded by

Momen Hussein
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

1-Devising Algorithms - A

The document describes an assignment to determine the algorithm that produced sample output sequences for different values of the parameter N. Students are tasked with writing down the algorithm, running it for N=6, having a non-programmer friend run it for N=6, and reporting the output sequence.

Uploaded by

Momen Hussein
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment 1: Devising Algorithms

Department of Communications and Computer Engineering


College of Engineering
Tafila Technical University

The numbers in the table below are the result of executing an algorithm that has one parameter
N, a non-negative integer, and produces sequences of integers as outputs. For values of N from 0
to 5, the algorithm produces the following sequences of numbers as outputs.

N Output
0 02
1 3579
2 6 8 10 12 14 16
3 9 11 13 15 17 19 21 23
4 12 14 16 18 20 22 24 26 28 30
5 15 17 19 21 23 25 27 29 31 33 35 37

Determine the algorithm that was used to generate the numbers in this table, and

1. Write it down.

2. Execute it for N = 6, and write down your result.

3. Give your description of the algorithm to a friend who is not a programmer, and ask him or
her to execute it for N = 6.

4. What is the sequence of numbers for N = 6?

You might also like