ITA - Week 1 Flashcards

1
Q

What is an algorithm

A

An algorithm is a sequence of unambiguous instructions for solving a problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the brute force approach

A

Trying every path to find the best solution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Algorithms vs Programs

A

Algorithm - Free from grammatical rules and content is most important

Program - Must obey syntax to be acceptable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is pseudocode

A

A mixture of natural language and programming language-like constructs used to describe an algorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Comments in pseudocode

A

// - single line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does x

A

X gets the value of 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Pseudocode array differences to programming languages

A

In pseudocode, arrays start from 1 rather than 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to find maximum number in a list

A

max(numbers)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the sieve of Eratosthenes

A

Lists all prime numbers not exceeding a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does the sieve of Eratosthenes work

A

Starts by stating 2 is prime
Crosses out all multiples of 2
Next number not crossed out is prime
Crosses out all multiples of next number etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Euclid’s algorithm

A

Finds greatest common denominator of two non negative, not both zero integers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the formula for Euclid’s algorithm

A

when n /= 0 do

r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly