top of page

Trace an algorithm

  • a01337106
  • 9 feb 2015
  • 1 Min. de lectura

There are a lot of types of algorithms as we saw on the last post. But, how is an algorithm in computer sciences? There are different languages in which an algorithm can be written.

Let's se an example for pseudocode:

1. int a=0;

2. loop I from 0 to 5

3. a=a+2;

4. end loop

The return of this algorithm will be a=12.

The explanation:

In the first line an integer a is declared with a value of cero.

Then it enters in a loop named I that repeats 6 times, from 0 to 5.

The integer a will act as an acomulator inside the loop I

Step by step the algortihm will be set as this:

First loop:

I=0

a=2

Second:

I=1

a=4

Third:

I=2

a=6

Fourth:

I=3

a=8

Fifth:

I=4

a=10

Sixth:

I=5

a=12

As we can see the loop increases by one each time and the acomulator a increases by 2 as estipulated inside the loop.

 
 
 

Comentarios


 THE ARTIFACT MANIFAST: 

 

This is a great space to write long text about your company and your services. You can use this space to go into a little more detail about your company. Talk about your team and what services you provide. Tell your visitors the story of how you came up with the idea for your business and what makes you different from your competitors. Make your company stand out and show your visitors who you are. Tip: Add your own image by double clicking the image and clicking Change Image.

 UPCOMING EVENTS: 

 

10/31/23:  Scandinavian Art Show

 

11/6/23:  Video Art Around The World

 

11/29/23:  Lecture: History of Art

 

12/1/23:  Installations 2023 Indie Film Festival

 FOLLOW THE ARTIFACT: 
  • Facebook B&W
  • Twitter B&W
  • Instagram B&W
 RECENT POSTS: 
 SEARCH BY TAGS: 

© 2023 by Karla Lugo. Proudly created with Wix.com

bottom of page