33
Welcome to Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C [email protected] 254-968-0792

What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C [email protected] 254-968-0792

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Welcome to

Computer Science!

COSC 1100 Freshman Seminar Fall 2016

Dr. Mircea Agapie Office: SCIENCE 213-C [email protected]

254-968-0792

Page 2: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

During the transition week (this week) we meet Tue and Wed 9-11 AM.

COSC 1100 Freshman Seminar Fall 2016

Once the semester officially starts (August 29), we meet twice a week, only for the first 8 weeks:

– Tue and Thu, 12:15 – 1:05 PM

Page 3: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Syllabus

COSC 1100 Freshman Seminar Fall 2016

Page 4: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Take attendance!

COSC 1100 Freshman Seminar Fall 2016

Page 5: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

The webpage for this class: http://faculty.tarleton.edu/agapie/cosc1100.html

The fastest way to get there is to enter agapie.net in a web browser, then click on the COSC 1100 link in the left panel.

COSC 1100 Freshman Seminar Fall 2016

Page 6: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Notebooks and note-taking

Click on the first link

Read the article

Answer the following questions (in your notebook ):

COSC 1100 Freshman Seminar Fall 2016

Page 7: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Notebooks and note-taking

– Who take more notes, students who use laptops or those who use notebooks?

– Who learns more, students who use laptops or those who use notebooks?

– How is the paradox explained in the article?

– How soon after note-taking were the students examined?

– What is the other major downside of electronic note-taking?

COSC 1100 Freshman Seminar Fall 2016

Page 8: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Do you have access to Degree Works?

COSC 1100 Freshman Seminar Fall 2016

Page 9: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Is your major declared as CS?

You can see this in Degree Works:

COSC 1100 Freshman Seminar Fall 2016

Page 10: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Are you registered in a Math course?

• If not …

COSC 1100 Freshman Seminar Fall 2016

Page 11: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

The Perils of New Technology

• Focus group: http://www.youtube.com/watch?v=L_iuAkJHqOk&fmt=18

• Help desk: https://www.youtube.com/watch?v=yUQRbqc2qtY

COSC 1100 Freshman Seminar Fall 2016

Page 12: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Computer Science

Hardware

+ Software

+ Algorithms

COSC 1100 Freshman Seminar Fall 2016

Page 13: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Computer Science

Hardware

+ Software

+ Algorithms

COSC 1100 Freshman Seminar Fall 2016

Page 14: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Computer Science

Hardware

+ Software

+ Algorithms

COSC 1100 Freshman Seminar Fall 2016

C

C++

Java

Matlab

Python

X86 Assembly

Page 15: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Computer Science

Hardware

+ Software

+ Algorithms

COSC 1100 Freshman Seminar Fall 2016

???

Page 16: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Computer Science

Hardware

+ Software

+ Algorithms

COSC 1100 Freshman Seminar Fall 2016

BuildingBlocks

Page 17: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Use numerical algorithms to calculate in your head:

• 17 x 9 17 x 11

• 24 x 5 24 / 5

• 1.3 x 4 1.3 x 8

COSC 1100 Freshman Seminar Fall 2016

Page 19: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Algorithm: Tic-Tac-Toe

COSC 1100 Freshman Seminar Fall 2016

Page 20: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

OK, so what’s the algorithm?

COSC 1100 Freshman Seminar Fall 2016

Created by Peter McOwan and Paul Curzon ofQueen Mary, University of London with supportfrom EPSRC and Google.More at www.cs4fn.org

Page 21: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

A philosophical problem ensues …

COSC 1100 Freshman Seminar Fall 2016

Created by Peter McOwan and Paul Curzon ofQueen Mary, University of London with supportfrom EPSRC and Google.More at www.cs4fn.org

Page 22: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Can all human intelligence be

described algorithmically?

COSC 1100 Freshman Seminar Fall 2016

Created by Peter McOwan and Paul Curzon ofQueen Mary, University of London with supportfrom EPSRC and Google.More at www.cs4fn.org

Page 23: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Another algorithm:

Adding positive numbers (algorithm ends when the first zero or negative number is encountered).

Do you see how this algorithm is different from all the previous ones?

COSC 1100 Freshman Seminar Fall 2016

Page 24: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Adding positive numbers (algorithm ends when the first zero or negative number is encountered).

Solution?

COSC 1100 Freshman Seminar Fall 2016

Page 25: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

OK, so how would we define an algorithm?

Algorithm = Sequence of simple steps, combined with decisions and loops

COSC 1100 Freshman Seminar Fall 2016

Page 26: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

And now, an example of an algorithm implemented directly in hardware!

COSC 1100 Freshman Seminar Fall 2016

Page 27: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

How would you use an adder to solve a new problem: Multiplication by 2?

COSC 1100 Freshman Seminar Fall 2016

What do we mean by this?

a 2·a

What hardware should go inside the Black Box?

Black Box

Page 28: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Solution

COSC 1100 Freshman Seminar Fall 2016

a a+a = 2·a

Congrats, you have just implemented an algorithm directly in the hardware!

Page 29: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Algorithm: Multiplication by 3

COSC 1100 Freshman Seminar Fall 2016

Build a circuit with one input a, that produces 3∙a at the output.

a 3·aBlack Box

Page 30: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Solution

COSC 1100 Freshman Seminar Fall 2016

a+a+a = 3·a

a 2·a

Page 31: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Algorithm: Multiplication by 4

COSC 1100 Freshman Seminar Fall 2016

Build a circuit with one input a, that produces 4∙a at the output.

a 4·aBlack Box

Page 32: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

The program rolls out the first week of the fall semester and includes 35 bicycles at six locations:

• Centennial Hall

• Horticulture Center

• Lillian Street Commuter Parking

• Lots P41 and P20N (near the water tank and intramural fields).

• Hunewell Ranch Annex (out of town)

COSC 1100 Freshman Seminar Fall 2016

Thanks to a new bike-shareprogram, getting around campus gets easier this fall at TSU!

Page 33: What does this algorithm print? - Tarleton State University...Computer Science! COSC 1100 Freshman Seminar Fall 2016 Dr. Mircea Agapie Office: SCIENCE 213-C agapie@tarleton.edu 254-968-0792

Seven-gear cruiser bicycles by Zagsterfeature adjustable seats, front and rear lights, a U-lock and handlebar basket.All bicycles are equipped with a flexible lock that riders can use for the duration of their rental to lock and unlock the bike anywhere along their trip. Riders can take bicycles off campus and into the Stephenville community.

COSC 1100 Freshman Seminar Fall 2016

Registering for the bike-share program is simple. Riders sign up by downloading the Zagstermobile app, available for both iPhone and Android. To use the app, riders enter the unique ID number found on the bike they wish to use. An access code for the lock box is then provided.

Riders can checkout a bike for free for up to three hours. Rides over three hours are charged an additional $3 per hour—up to $24—or for eight additional hours. If a bicycle is kept for more than 24 hours, a $25 fee is assessed.

Complete details about Tarleton’s bike-share program, pricing, locations on campus and FAQs are available at www.zagster.com/tarleton. Users also can view a “How to Ride with Zagster” video on YouTube: www.youtube.com/watch?v=iZQkpK3K3Jw.

As a reminder, bicycles are considered vehicles in the state of Texas. Riders are liable for any injuries caused to pedestrians, and for property damage.