Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2015 Euiseong Seo

Similar documents
Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2014 Euiseong Seo

CS2303 C14 Systems Programming Concepts. Bob Kinicki

Concepts in Programming Languages

Discovering Computers 2008

Introduction to Computer Science I

Low-Level Languages. Computer Programs and Programming Languages

Topic I. Introduction and motivation References: Chapter 1 of Concepts in programming languages by J. C. Mitchell. CUP, 2003.

CSc 520. Course Outline (Subject to change) Course Outline (Subject to change)... Principles of Programming Languages. Christian Collberg

Welcome to Introduction to Computer Science I

Discovering Computers Chapter 13 Programming Languages and Program Development

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

Lecture 09. Ada to Software Engineering. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

CSCI 3136 Principles of Programming Languages

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

COMP 201: Principles of Programming

Programming Languages, Summary CSC419; Odelia Schwartz

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

Introduction to Engineering Using Robotics Experiments. Dr. Yinong Chen

Languages october 22, 2017 Éric Lévénez < FORTRAN III end-1958 FORTRAN II FORTRAN I october 1956

Com S 541. Programming Languages I

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples

Computers and programming languages introduction

Introduction to Basis and Practice in Programming

CS 3304 Comparative Languages. Lecture 1: Introduction

COSC 2P90 Programming Languages & Object-Orientation

CS558 Programming Languages

CS120 Computer Science I. Instructor: Jia Song

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering?

Introduction to Scientific Computing Languages

Lecture 1: Course Introduction

Introduction to Scientific Computing Languages

Lecture 1: Course Introduction

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?

CS240: Programming in C

PLAGIARISM. Administrivia. Course home page: Introduction to Programming Languages and Compilers

Introduction to Programming Languages and Compilers. CS164 11:00-12:00 MWF 306 Soda

Objective: To learn meaning and concepts of programming. Outcome: By the end of this students should be able to describe the meaning of programming

Programming Languages 1. Introduction. Oscar Nierstrasz

Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008.

Introduction. A. Bellaachia Page: 1

TTh 9.25 AM AM Strain 322

COURSE OVERVIEW. Introduction to Computer Engineering 2015 Spring by Euiseong Seo

What is a programming language?

CSc 372 Comparative Programming Languages

Modern Stored Procedures Using GraalVM

San José State University Computer Science Department CS157A: Introduction to Database Management Systems Sections 5 and 6, Fall 2015

Compilation 2012 The What and Why of Compilers

CIS 408 Internet Computing (3-0-3)

Why study Programming Language Concepts? Chapter One. Language Evaluation Criteria. Programming Domains. Readability Writability Reliability Cost

Logic Programming II & Revision

Chapter 1. Preview. Reason for Studying OPL. Language Evaluation Criteria. Programming Domains

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106

Chapter 2 Preview. Preview. History of Programming Languages. History of Programming Languages. History of Programming Languages

CS A331 Programming Language Concepts

Lecture 2. Programs and Pseudocode. Daily Puzzle

Programming Language Concepts 1982, 1987, Outline. Period

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

Problem Solving With C++ Ninth Edition


Programs are: CMPSCI 105/119/120: Programming, Flowchar<ng, and Running Program Flowcharts

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik

Programming Languages and Program Development

Technology in Action. Chapter Topics (cont.) Chapter Topics. Reasons for Software Programming. Information Systems 10/29/2010

EECE 321: Computer Organization

! Broaden your language horizons. ! Study how languages are implemented. ! Study how languages are described / specified

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

Introduction to.net, C#, and Visual Studio. Part I. Administrivia. Administrivia. Course Structure. Final Project. Part II. What is.net?

Programming Languages and Program Development Life Cycle Fall Introduction to Information and Communication Technologies CSD 102

CSI32 Object-Oriented Programming

SOFTWARE ARCHITECTURE 6. LISP

Outline. CIS 110: Introduction to Computer Programming. What is Computer Science? What is computer programming? What is computer science?

INFS 2150 (Section A) Fall 2018

Chapter 2. Pseudocodes: Speedcoding. 2.2 Minimal Hardware Programming: Pseudocodes. Evolution of the Major Programming Languages

Chapter 1. Preliminaries

Compiler Design. Dr. Chengwei Lei CEECS California State University, Bakersfield

Principles of computer programming. Profesor : doc. dr Marko Tanasković Assistent : doc. dr Marko Tanasković

Advanced Relational Database Management MISM Course S A3 Spring 2019 Carnegie Mellon University

Comparative Programming Languages

Technology in Action. Chapter Topics. Scope creep occurs when: 3/20/2013. Information Systems include all EXCEPT the following:

Course outline. CSE 341: Programming Languages. Why study programming languages? Course motivation and objectives. 1 lecture: Concepts

Principles of Programming Languages. Lecture Outline

Lecture 01 & 02 Computer Programming

Computer Science Department

A little bit of history. Jordi Cortadella Department of Computer Science

Introduction to Programming Languages. CSE 307 Principles of Programming Languages Stony Brook University

Hi! My name is Sorin. Programming Languages. Why study PL? (discussion) Why study PL? Course Goals. CSE : Fall 2017

CVEN 302. Computer Applications in Engineering and Construction. Dr. Tony Cahill Environmental and Water Resources Division

Full version is >>> HERE <<<

Why are there so many programming languages?

CMPE012 Computer Engineering 12 (and Lab) Computing Systems and Assembly Language Programming. Summer 2009

Programmiersprachen (Programming Languages)

Introduction to System Programming Course 2015 Spring Euiseong Seo

Course and Unix Intro

Concepts of Programming Languages

INFS 214: Introduction to Computing

1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation

COMPILER DESIGN LECTURE NOTES

1DL321: Kompilatorteknik I (Compiler Design 1)

Transcription:

Principles in Programming: Orientation & Lecture 1 1

Course Objectives Introduce various subjects in computer science through puzzles and problems Most problems came from ICPC 2

Introduction Instructor: Euiseong Seo Associate professor, Software Dept. Web page: http://csl.skku.edu/euiseong E-mail: euiseong@skku.edu Office: #85564 (5F of Industrial Collaboration Bldg.) Course Homepage http://csl.skku.edu/swe2004s15 Lab Thursday class #400222 Conducted by Two TAs 3

Course Elements 14 Lectures (once every week) (10%) 10 Programming Labs (20%) 2 Individual Programming Homework Assignments (15%) 1 Team Project (15%) Final Exam (40%) Most questions will be based on labs and assignments Programming 4

Textbook Programming Challenges by Steven S. Skiena and Miguel A. Revilla Springer You can download from the SKKU library 5

Course Rules (1/2) Cheating in exams machine check will receive an F for the course Late homework 10% penalty per day Cheating on homework will receive a 0 point 1% penalty for missing a lecture class 2% penalty for missing a Lab. 6

Course Rules (2/2) not attending a class includes not attending a class being late to a class leaving a class in the middle chatting in class having the mobile phone on in class if you sleep, you will die!! 7

Course Outline 8

Problem Solving Using C Basic Software Engineering Programming Patterns Problem Solving Techniques Practice 9

What You Need to Solve a Problem by Programming Programming Language Skills Correct rules Identifying rule violations Programming Skills Training on programming patterns Training on software engineering methods Problem Solving Skills Logical thinking 10

Programming Programming Is To Use the Dumb Computer To Solve a Problem That A Human Cannot Solve Fast Enough. The Computer Needs Very Very Very Precise and Detailed Instructions. The Instructions Must Be in a Programming Language, Not a Natural Language. 11

Natural Language What is 27.2 times 13.8? 12

Programming Languages Machine Languages Assembly Languages High-Level Languages 13

Machine Language 000000 00001 00010 00110 00000 100000 Add the registers 1 and 2 and place the result in register 6 100011 00011 01000 00000 00001 000100 Load a value into register 8, taken from the memory cell 68 after the location listed in register 3: 000010 00000 00000 00000 00100 000000 Jump to the memory address 1024: 14

Assembly Language MOV r0, #0C load base address of string into r0 LOAD: MOV r1,(r0) load contents into r1 CALL PRINT call a print routine to print the character in r1 INC r0 point to the next character JMP LOAD load next character 15

High-Level Language float length, width, area; length = 27.2; width = 13.8; area = length * width; 16

High-Level Languages Over 500 Languages ( http://en.wikipedia.org/wiki/list_of_programming_lang uages_by_category) Basic, FORTRAN, COBOL, RPG (Algol, Pascal, PL/1), C C++, C#, Java (ADA, Smalltalk, Eiffel) Perl, TCL, Java Script, PHP, Python, Ruby SNOBOL, LISP, (Scheme) MATLAB, (APL) Shell, Awk, REXX SQL, (Prolog), XML, Xquery, XSLT, Postscript, OWL 4GL UML Verilog, VHDL 17

Executing Programs 1. Compile Converting programs written in a high-level language into an assembly language or a pseudo code 2. Assemble Converting programs written in an assembly language into a machine language Interpret Running programs written in a high-level language with out compiling (one instruction at a time) 18

Programming Languages You Can Solve Any Problem Using Any Programming Language But Different Languages Are Designed To Serve Different Purposes Better. FORTRAN for scientific computations COBOL for business data processing LISP for list processing VisualBasic for user-interface programming SQL, PHP for database applications C++, Java for object-oriented software development C for most modern enterprise/scientific applications 19

Sample Problem: Game Strategy Alice and Bob are playing a board game. The board is divided into positions labeled a, b, c, d,... and the players use a gamepiece to mark the current position. Each round of the game consists of two steps: 1. Alice makes a choice. Depending on the current position, she has different options, where each option is a set of positions. Alice chooses one set S among the available sets of positions. 2. Bob makes a choice. His choice is one position p from the set S that Alice chose in step 1. Bob moves the gamepiece to position p, which is the position for the start of the next round. Prior to the first round, each player independently selects one of the positions and reveals it at the start of the game. Bob s position is where the game starts. Alice wins the game if she can force Bob to move the gamepiece to the position she has chosen. To make things interesting, they have decided that Bob will pay Alice a certain amount if he loses, but Alice must pay Bob a certain amount after every round. The game now ends if Alice s position is reached or when Alice runs out of cash. Both Alice and Bob play optimally: Alice will always choose an option that will lead to her winning the game, if this is possible, and Bob will always try to prevent Alice from winning. For all possible start and end positions, Alice would like you to determine whether she can win the game and if so, how many rounds it will take. 20

Sample Problem: Game Strategy Input The input consists of a single test case. The first line contains the number of positions n (1 apple n apple 25). The n positions are labeled using the first n letters of the English alphabet in lowercase. The rest of the test case consists of n lines, one for each position p, in alphabetical order. The line for position p contains the options available to Alice in position p. It starts with the number of options m (1 apple m<2 n ), which is followed by m distinct strings, one for each option. Each string contains the positions available to Bob if Alice chooses that option. The string has at least 1 character, the characters (which correspond to valid board positions) are in alphabetical order, and no characters are duplicated. The total number of options for the test case is at most 10 6. Output For each position p in alphabetical order, display one line. In that line, for each position q in alphabetical order display the minimal number of rounds in which Alice can be guaranteed to arrive at position q when starting the game in position p, or 1 if Alice cannot be guaranteed to reach q from p. 21

Sample Problem: Game Strategy Sample Input 1 Sample Output 1 2 2 ab b 1 b 0 1-1 0 Sample Input 2 Sample Output 2 3 1 b 2 b a 2 ab ac 0 1-1 1 0-1 2 2 0 22