Week 1 Algorithms and Thinking like a computer scientist

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What are primitives?

A primitive is a basic operation used for writing an algorithm. Some primitives that computers understand are "Add these two numbers" or "Compare these two numbers to see which is smaller." By using primitives, we can write unambiguous algorithms for computers.

How does a recipe allow you to reuse "captured intelligence"?

A recipe gives you specific instructions for preparing a certain food like a cake. Although you may not be an expert chef, you can still bake the same cake that an expert chef bakes by following his recipe. In this case, the recipe represents the captured intelligence of the chef.

What is an algorithm?

An algorithm is a set of instructions for solving a problem.

What does it mean for an instruction to be ambiguous?

An ambiguous instruction lacks the details necessary for it to be executed. For example, an ambiguous instruction for a person might be "Bake a chocolate cake." More detailed instructions are usually required for a person to solve the problem of making a chocolate cake.

Why are algorithms important to computers?

Computers are general purpose machines that must be given instructions in order to do useful work. We can make computers "intelligent" by programming them with various algorithms. Then the computers can use the algorithms we created to solve problems.

What limitation do computers have as problem solving machines?

Computers can only solve problems whose solutions can be stated in the form of an algorithm.

What does problem solving involve?

Formulating problems, thinking creatively about solutions, and expressing solutions clearly and accurately.

What does it mean for an algorithm to be well-ordered?

In an algorithm that is well-ordered, we always know which instruction should be performed next. There is no uncertainty regarding the execution order of instructions.

What is the most important skill for a computer scientist?

Problem solving.

Why is it significant that algorithms allow us to capture intelligence and share it with others?

Since algorithms are a way of sharing intelligence, many people can use this intelligence without having to know all the background principles involved. No one can become an expert in all fields, so algorithms are an important tool for sharing solutions.

What are the five characteristics of an algorithm?

The five characteristics are listed below. 1. Algorithms are well-ordered. 2. Algorithms have unambiguous operations. 3. Algorithms have effectively computable operations. 4. Algorithms produce a result. 5. Algorithms halt in a finite amount of time.

The following algorithm violates several of the characteristics presented in this section. Identify the characteristics that are violated along with the incorrect instructions. 1. Write your last name at the top of a sheet of paper 2. If you last name begins with 'H', go to step 4 or step 5 3. Draw something. 4. Write the weather for May 4, 2032 under your last name. 5. Go back to step 1.

The incorrect steps are listed along with a description of the characteristic violated. Step 2 violates the characteristic that algorithms should be well-ordered. We cannot be sure which instruction should come next. Step 3 violates the characteristic that instructions should be unambiguous. We cannot be sure what to draw or even where it should be drawn. Step 4 violates the characteristic that instructions should be doable. No one can accurately predict the weather for this date. Step 5 violates the characteristic that algorithms should be finite. This instruction causes the algorithm to loop indefinitely.

Why is it necessary for algorithms to produce a result?

Unless an algorithm produces a result, we have no way to verify that the algorithm's solution is correct.


Set pelajaran terkait

Firearms Fundamentals of Shooting

View Set

Chapter 18 Integrated Marketing Communications

View Set

World Geography - Chap. 18 Section 4

View Set

US History EOC STAAR Review Day 5 & 6

View Set

Nursing Today: Transitions and Trends - Chapter 20

View Set

American Government Basic Skills Test

View Set