Big Idea 4 Flashcards

1
Q

What are the three building blocks of algorithms and what are examples?

A

Sequencing- a function
Selection- if statement
Iteration- for loops

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

What is the definition of sequencing?

A

Sequencing is the application of each step of an algorithm in the order in which the statements are given.

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

What is the definition of selection?

A

Selection uses a Boolean condition to determine which of two parts of an algorithm is used.

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

What is the definition of selection?

A

Iteration is the repetition of part of an algorithm until a condition is met or for a specified number of times.

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

Algorithms can be combined to make new algorithms. True or false?

A

True. Many algorithms have individual operations that undergo. When combined, they can achieve a greater goal that integrates each intention. By using algorithms as building blocks for constructing a new algorithm, it ensures the new algorithm being correct.

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

Is there only one way to solve a problem?

A

No. Many different algorithms can be made to solve one issue. The more algorithms you can develop for the same problem shows insight to the problem.

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

What language types can algorithms include (give examples)?

A

natural languages (just commanding), pseudocode (actions and demands based on logic-like natural languages), and visual (snap) and textual programming languages (python).

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

What do natural languages and pseudo codes consist of?

A

They describe algorithms so that humans can understand them.

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

Can programming languages be used in ay domain? Why or why not?

A

Some programming languages are designed for specific domains and are better for expressing algorithms in those domains.

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

The language used to express the algorithm can affect whether an algorithmic solution exists. True or false?

A

False. The language used only affects the clarity or readability of the algorithm.

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

Does it really matter what language you use when expressing any algorithm?

A

Nope. They’re all equivalent.

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

Why would one consider one language versus another?

A

For the purpose of clarity or readability-whatever the user prefers, basically.

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

What is considered a reasonable time for an algorithm to run?

A

The number of steps the algorithm takes should be less than or equal to a polynomial function(constant, linear, square, cube, etc) of the size of the input.

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

What should a coder do if a problem cannot be solved in a reasonable time?

A

In these cases, heuristic approaches may be helpful to find solutions in reasonable time.

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

What is a heuristic approach?

A

A heuristic is a technique that may allow us to find an approximate solution when typical methods fail ti fins an exact solution.

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

What optimization problems cannot be solved within a reasonable time without approximations?

A

A “find the best” or “find the smallest” problem would be examples.

17
Q

Can any problem be solved through an algorithm?

A

No. You cannot turn to an algorithm for an answer as to why he isn’t answering your email. Deal with it.

18
Q

What is an undecidable problem?

A

An undecidable problem may have instances that have an algorithmic solution, but there is no algorithmic solution that solves all instances of the problem.

19
Q

What is a decidable problem?

A

A decidable problem is one in which an algorithm can be constructed to answer “yes” or “no” for all inputs. (e.x. is the number even?)

20
Q

How does one analyze an algorithm empirically?

A

Empirical analysis of an algorithm is done by implementing the algorithm and running it on different inputs. (trial and error)

21
Q

How can you test the efficiency or correctness of an algorithm?

A

Through reasoning formally or mathematically about the problem (not by using trial and error).

22
Q

Why might one want to go through the trouble to finding the most efficient version of an algorithm?

A

Finding an efficient algorithm for a problem can help solve larger instances of the problem.

23
Q

What two factors are taken into account when considering efficiency?

A

Execution time and memory usage.

24
Q

What instances are linear and binary search used?

A

Linear search can be used when searching for an item in any list; binary search can be used only when the list is sorted.