Top Banner
Algorithm development
26

Algorithm development

Dec 31, 2015

Download

Documents

perry-mejia

Algorithm development. The invention of the computer. Programming language developments: Machine code Assembler easier to write, debug, and update High level languages strive to be machine independent easier to learn and use 1954 – FORTRAN 1961 – COBOL then ALGOL, LISP, BASIC - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Algorithm development

Algorithm development

Page 2: Algorithm development

The invention of the computer

Programming language developments:1. Machine code2. Assembler

easier to write, debug, and update3. High level languages

strive to be machine independent easier to learn and use 1954 – FORTRAN 1961 – COBOL then ALGOL, LISP, BASIC 1970 – Pascal 1980’s – C 1990’s – C++, Java (originally called ?) and many, many others

Page 3: Algorithm development

High level langauges (HLL)

Not directly understood by the computer

Humanly readable

Requires the user of a compiler Compiler = program

Input = code written in a HLL Output = machine code

Page 4: Algorithm development

Pascal (an HLL)

1970’s Support for “structured programming”

Control constructs1. Linear sequence of commands/instructions

2. Repetition

3. Selection

Top-down programming Problem is broken down into a series of smaller

problems which are solved. Divide-and-conquer technique.

Page 5: Algorithm development

Types of software

1. OS (operating system)

2. Programming environment/tools

3. Applications

Page 6: Algorithm development

Operating Systems (OS)

Windows Linux

Android (linux-based) Unix Mac OS many others

Page 7: Algorithm development

Programming environments/tools

Tools emacs (an editor – not a word processor) vi g++ gdb

Page 8: Algorithm development

Programming environments/tools

IDE’s (Integrated Development Environment) consist of: editor, compiler or interpreter,

debugger, linker

examples: jGrasp, netbeans, Eclipse, Ready, Visual C++, Visual BASIC, JBuilder, and many others

Page 9: Algorithm development

Applications

Computer games Word processors Graphics packages Virtual reality software Web browsers Presentation Database Spreadsheet And many others.

Page 10: Algorithm development

Social issues

Privacy/anonymity

Quality of information

Page 11: Algorithm development

Program development

Our programming language is Java.

The IDE we will use is jGrasp. Editor is used to type in program text (it is

not a word processor; don’t use a word processor).

Compiler (syntax errors) Run/execute (semantic errors)

Page 12: Algorithm development

Program development

Java is an object-oriented language. (Note: Case sensitive.)

Method named operation constructor (ctor)

special method w/ same name as class performs initialization class may have more than 1 ctor

Class named group of related methods

Page 13: Algorithm development

Recall “What is a computer?”

INPUT

(information)

PROCESSING OUTPUT

(information)

MEMORY

Page 14: Algorithm development

Definitions (from http://mathworld.wolfram.com/Algorithm.html)

An algorithm is a specific set of instructions for carrying out a procedure or solving a problem, usually with the requirement that the procedure terminate at some point.

Page 15: Algorithm development

Definitions (from http://mathworld.wolfram.com/Algorithm.html)

Specific algorithms sometimes also go by the names: method procedure routine subroutine technique

Page 16: Algorithm development

Definitions (from http://mathworld.wolfram.com/Algorithm.html)

The word “algorithm” is a distortion of al-Khwārizmī, a Persian mathematician who wrote an influential treatise about algebraic methods.

Page 17: Algorithm development

Definitions (from http://mathworld.wolfram.com/Algorithm.html)

The process of applying an algorithm to an input to obtain an output is called a computation.

Page 18: Algorithm development

Recall “What is a computer?”

INPUT

(information)

PROCESSING OUTPUT

(information)

MEMORY

How can a Java program perform output?

Page 19: Algorithm development

How can a program perform output?

System.out.println( "hello world" );

Page 20: Algorithm development

blocks

{

System.out.println( "Welcome!" );

System.out.println( "Enjoy the show." );

}

Page 21: Algorithm development

Method/function/procedure

public static void main ( String param[] ) {

System.out.println( "hi there" );

}

Page 22: Algorithm development

Defining our own objects

class MyFirstClass {

public static void main ( String param[] ) {

System.out.println( "hi there" );

}

}

Page 23: Algorithm development

Recall “What is a computer?”

INPUT

(information)

PROCESSING OUTPUT

(information)

MEMORY

How can a Java program perform input?

Page 24: Algorithm development

How can a Java program perform input?

Scanner s = new Scanner( System.in );

String str = s.nextLine();

Page 25: Algorithm development

We can mix input and output.

Scanner s = new Scanner( System.in );

System.out.print( "Enter your name: " );

String name = s.nextLine();

System.out.println( "Thanks." );

s.close();

Page 26: Algorithm development

Complete program that does both input & output.import java.util.Scanner;

class MySecondClass {

public static void main ( String param[] ) {

Scanner s = new Scanner( System.in );

System.out.print( "Enter your name: " );

String name = s.nextLine();

System.out.println( "Thanks." );

s.close();

}

}