Computing Fundamentals Slides

Embed Size (px)

Citation preview

  • 8/19/2019 Computing Fundamentals Slides

    1/127

      Computer Fundamentals

  • 8/19/2019 Computing Fundamentals Slides

    2/127

    Course Plan Basic Understanding

  • 8/19/2019 Computing Fundamentals Slides

    3/127

    Muhammad Asim Rehmat MS Computer Science in Artifcial Intelligence, UET

    Lahore, B.S. in CSE UET Lahore. Ph! in Automation.. Thesis in progress Belongs to SIAL"#T $ot %irst pri&es in man' (ational)International

    so*t+are)hard+are competitions !eelopment o* PA" Linu- at UET an' man' e

    $oernment pro/ects $ot more than 01 %irst pri&es in All Asia and All

    Pa2istan Engineering So*t+are Competitions asPro/ect Adisor

    Su3/ects Taught so *ar4 5o3otics C(C Machines, Em3edded S'stems,

    Industrial Automation, Control S'stems, ArtifcialIntelligence, !L!, (umerical Anal'sis etc

  • 8/19/2019 Computing Fundamentals Slides

    4/127

    La3 Per*ormance 617 Personal)Pro*essional $ro+th 017 Term Pro/ect 817 Mids 017 %inal 617

  • 8/19/2019 Computing Fundamentals Slides

    5/127

    How is a computer  defined?

    Electronic device operating under the control

    of instructions stored in its own memory A computer is an electronic machine that

    takes input from the user , processes thegiven input and generates output in the form

    of useful information. An electronic device that receives data,

    processes data, stores data, and produces aresult (output).

  • 8/19/2019 Computing Fundamentals Slides

    6/127

    Computers areeverywhere

    In usiness

    In !u"lication #ield

    In Education #ield

    In $overnment %rgani&ations

    In 'edical #ield

    In cience #ield

    In Entertainment #ield

  • 8/19/2019 Computing Fundamentals Slides

    7/127

    A computer has high speed of calculation,

    diligence, accuracy, relia"ility, or versatilitywhich made it an integrated part in all

    "usiness organi&ations.

    !ayroll calculationsudgetingales analysis

    #inancial forecasting'anaging employees data"ase'aintenance of stocks etc.

    Business

  • 8/19/2019 Computing Fundamentals Slides

    8/127

    oday "anking is almost totally dependent

    on computer. anks provide followingfacilities*

    anks provide online accounting facility,

    which includes current "alances, deposits,

    overdrafts, interest charges, shares, and

    trustee records.

    A' machines are making it even easierfor customers to deal with "anks

    Banking

  • 8/19/2019 Computing Fundamentals Slides

    9/127

    +omputers are "eing vastly used in

    education*

    Admission systemsEamination-i"raryesearch pu"licationsimulation softwares

    Education

  • 8/19/2019 Computing Fundamentals Slides

    10/127

    +omputers are "eing vastly used in

    education*Advertising / 0ith computers, advertising

    professionals create art and graphics, write

    and revise copy, and print and disseminateAt Home hopping / Home shopping has

    "een made possi"le through use of

    computeri&ed catalogues that provide

    access to product information and permitdirect entry of orders to "e filled "y the

    customers.

    Sales and Marketing

  • 8/19/2019 Computing Fundamentals Slides

    11/127

  • 8/19/2019 Computing Fundamentals Slides

    12/127

    %ne of ma2or areas is +A1 (+omputer aided

    design). hat provides creation andmodification of images. ome fields are:tructural Engineering / Requires stress andstrain analysis for design of Ships, Buildings, cars,

     Airplanes etc.

    Industrial Engineering / Computers deal withdesign, implementation and improvement of integrated

    systems of people, materials and equipment.

    Architectural Engineering / Computers help inplanning towns, designing buildings, determining a

    range of buildings on a site using both ! and "!

    drawings.

    Engineering Design

  • 8/19/2019 Computing Fundamentals Slides

    13/127

    +omputers are largely used in armies

    'issile +ontrol'ilitary +ommunication'ilitary %peration and !lanningmart 0eapons

    Military

  • 8/19/2019 Computing Fundamentals Slides

    14/127

    ome main areas in this category are*

    E/mail+hattingocial 3etworking4ideo/conferencingmart phones

    Communication

  • 8/19/2019 Computing Fundamentals Slides

    15/127

    he uni5ue capa"ilities and characteristicsof a computer are*

    peedtorage capacityAccuracyelia"ility4ersatility

    Capailities

  • 8/19/2019 Computing Fundamentals Slides

    16/12798

    !nput devices "utputdevices

    Storagedevices

    C#$ Memory

  • 8/19/2019 Computing Fundamentals Slides

    17/127

    9.9. Input !eices :"e'3oard, Mouse, etc.;Input !eices :"e'3oard, Mouse, etc.;

    ideo Card, Sound Card, or

    (IC;(IC;

    8.8. ?ard !rie Ports and Connections :USB,?ard !rie Ports and Connections :USB,

    %ire+ire, etc.;%ire+ire, etc.;

  • 8/19/2019 Computing Fundamentals Slides

    18/127

    MouseMouse

    "e'3oard"e'3oard

    MicrophoneMicrophone

    ScannerScanner

    @e3cam@e3cam

  • 8/19/2019 Computing Fundamentals Slides

    19/127

    Monitor

    Printer

    Spea2er)?eadphone

  • 8/19/2019 Computing Fundamentals Slides

    20/127

    A deice that interprets and runs thecommands that 'ou gie to the computer.

    Also re*erred to as the processor.

     T+o ma/or 3rands are Intel and AM!.

    E-amples4 Intel Core < !uo, AM! Turion <

  • 8/19/2019 Computing Fundamentals Slides

    21/127

    Memor' is +here in*ormation is stored andMemor' is +here in*ormation is stored and

    retrieed 3' the CPU.retrieed 3' the CPU.

     There are t+o main t'pes o* memor'4 There are t+o main t'pes o* memor'4

    ◦ 5andom Access Memor' :5AM;4 It is the5andom Access Memor' :5AM;4 It is the

    main memor' and allo+s 'ou tomain memor' and allo+s 'ou to

    temporaril' store commands and data.temporaril' store commands and data.

    5ead #nl' Memor' :5#M;4 It is the5ead #nl' Memor' :5#M;4 It is thememor' that retains its contents eenmemor' that retains its contents een

    a*ter the computer is turned o.a*ter the computer is turned o.

  • 8/19/2019 Computing Fundamentals Slides

    22/127

    o  Is the main circuit "oard inside the computer.Is the main circuit "oard inside the computer.

    o  Has tiny electronic circuits and otherHas tiny electronic circuits and other

    components on it.components on it.

    o  +onnects input, output, and processing+onnects input, output, and processing

    devices together (+!6, 'emory, Hard 1rive,devices together (+!6, 'emory, Hard 1rive,

    141 1rive)141 1rive)

    o  ells the +!6 how to run.ells the +!6 how to run.

  • 8/19/2019 Computing Fundamentals Slides

    23/127

    >ideo Card is connected to the computer>ideo Card is connected to the computermonitor and is used to displa' in*ormationmonitor and is used to displa' in*ormationon the monitor.on the monitor.

    (et+or2 Inter*ace Card :(IC; is connected(et+or2 Inter*ace Card :(IC; is connectedto other computers so that in*ormation canto other computers so that in*ormation can3e e-changed 3et+een them.3e e-changed 3et+een them.

    Sound Card conerts audio signalsSound Card conerts audio signals:microphone or audio tape; +hich can 3e:microphone or audio tape; +hich can 3estored as a computer audio fle.stored as a computer audio fle.

  • 8/19/2019 Computing Fundamentals Slides

    24/127

    ?ard !is2?ard !is2

    %lash !rie%lash !rie

    C!5#MC!5#M

    !>!5#M!>!5#M

  • 8/19/2019 Computing Fundamentals Slides

    25/127

    Uniersal Serial Bus :USB; PortUniersal Serial Bus :USB; Port

    %ire@ire :similar to USB 3ut *aster;%ire@ire :similar to USB 3ut *aster;

    (et+or2 Port :Ethernet;(et+or2 Port :Ethernet;

    Parallel Port and Serial PortParallel Port and Serial Port

    !ispla' Adapter!ispla' Adapter

    Po+erPo+er

  • 8/19/2019 Computing Fundamentals Slides

    26/127

  • 8/19/2019 Computing Fundamentals Slides

    27/127

     The intangi3le set o* instructions that tellsthe computer +hat to doD 2no+n asprograms or so*t+are programs.

  • 8/19/2019 Computing Fundamentals Slides

    28/127

    #perating S'stem So*t+are◦ Sets the rules *or ho+ computer hard+are and

    application so*t+are +or2 together, controls theoperation o* the computer. E-ample4 @indo+s

    Application So*t+are◦ Lets 'ou accomplish specifc tas2s 3ased on 'our

    needs. E-amples4 MS @ord, E-cel, Access, MS @or2s

  • 8/19/2019 Computing Fundamentals Slides

    29/127

    Boots :starts up; the computer %ormats dis2s Creates *olders

    Saes and retriees fles Moes and copies fles

    Eer' Computer ?as #perating S'stem

    So*t+are

     

  • 8/19/2019 Computing Fundamentals Slides

    30/127

    So*t+are that +or2s +ith the operating s'stem to meet aspecifc need or per*orm a specifc tas2

    E-amples4

      MS @ord

      MS E-cel

      MS Po+erPoint

      Internet E-plorer

  • 8/19/2019 Computing Fundamentals Slides

    31/127

    @ord Processing◦ Program that allo+s 'ou to create, edit, and print

    te-t documents 5eport, F'er, memo

    Spreadsheet◦

    (um3ered 5o+s and Lettered Columns◦ Intersection o* a ro+ and column is a cell $rade 3oo2, fnancial in*o

    !ata3ase◦ Lets 'ou set up an electronic fling s'stem◦ Enter te-t and num3ers %ind, search, and print in*o in dierent +a's

    Address 3oo2, Card Catalog

  • 8/19/2019 Computing Fundamentals Slides

    32/127

    0<

    Humanlanguage

    #rgramming language

    Computerlanguage

    C*

    *(+ava(,C(,B(-.et(C/

    compiler

    I +ant to add one andone

    9G9 191199191199

    "peratingSystem

  • 8/19/2019 Computing Fundamentals Slides

    33/127

    @hat is a net+or2H

    ""

    One type is

    a modem

    Enables a

    connection

    betweencomputers

    Enables a

    connection

    between

    computers

    Cables

    Cellular

    radio

    Telephone

    lines

    Satellites

    CommunicationsMedia

    Communications

    Media

    Communications

    Device

    Communications

    Device

    Collection of computers and devices connected together

  • 8/19/2019 Computing Fundamentals Slides

    34/127

    @h' do +e need net+or2H

    "#

    To shareTo share

    ResourcesResources

    Hardware

    devices

    Hardware

    devicesSoftware

    programs

    Software

    programs

    DataDataTo save

    timeand

    money

    To save

    timeand

    moneynformationnformation

  • 8/19/2019 Computing Fundamentals Slides

    35/127

    @hat is a sererH

    "

    Manages the

    resources on

    a networ! 

    " client accesses

    the resources

    on the server

  • 8/19/2019 Computing Fundamentals Slides

    36/127

    @hat is the InternetH

    "

    #orldwide collection of networ!s that connects

    millions of computers

  • 8/19/2019 Computing Fundamentals Slides

    37/127

    "

    #hy do users access the nternet$

    %& nformation

    '& Shopping

    (& )an!ing and nvesting*& Classes

    +& Entertainment

    ,& Communications

  • 8/19/2019 Computing Fundamentals Slides

    38/127

  • 8/19/2019 Computing Fundamentals Slides

    39/127

    ?o+ do 'ou install and run a so*t+are programH

    "

    tep 7.nsert the program

    disc into the CD0

    ROM drive

    tep 8. nstall the

    software program byinstruction in the disc.

    then run the program

    tep 9. 

    The program e-ecutes

    " program is a series of instructions that tells the

    computer what to do

  • 8/19/2019 Computing Fundamentals Slides

    40/127

    @hat is a graphical user inter*ace :$UI;H

    #

    "llows you to interact with the software

    using graphics and icons

    Controls how you enter data and how the

    screen displays information

  • 8/19/2019 Computing Fundamentals Slides

    41/127

    @hat is s'stem so*t+areH

    #

    Operating System 1OS2Operating System 1OS2is a set of programs

    that coordinates all

    activities among

    computer hardware

    devices and allowsusers to run

    application software

    Operating System 1OS2Operating System 1OS2is a set of programs

    that coordinates all

    activities among

    computer hardware

    devices and allows

    users to run

    application software

    3tility 4rograms3tility 4rograms allow the user toperform maintenance0type tas!s

    usually related to managing a

    computer. its devices or its programs

    3tility 4rograms3tility 4rograms allow the user toperform maintenance0type tas!s

    usually related to managing a

    computer. its devices or its programs

    4rograms that control the operations of the computer

    and its devices

  • 8/19/2019 Computing Fundamentals Slides

    42/127

    @hat is application so*t+areH

    #

    4resentation5raphics

    Spreadsheet

    Database

    #ord

    4rocessing

    4rograms that perform specific tas!s for users Suite

    4opular software applications

    bundled together as a single unit

  • 8/19/2019 Computing Fundamentals Slides

    43/127

    @hat is a programmerH

    #

    Someone who develops application or system software

    4rogrammer writes instructionsto direct computer to processdata into information

  • 8/19/2019 Computing Fundamentals Slides

    44/127

    #

    #hat are the categories of computers$

    !ersonal computers (desktop)'o"ile computers and mo"ile

    devices'idrange servers'ainframe computers

    upercomputers

  • 8/19/2019 Computing Fundamentals Slides

    45/127

    @hat are the t+o most popular series o*

    personal computersH

    #

    4C and compatibles

    use the #indows

    operating system

    "pple Macintosh

    uses the Macintosh

    operating system1Mac OS2

  • 8/19/2019 Computing Fundamentals Slides

    46/127

    @hat is a des2top computerH

    #

    Designed so all of the components fit on or under

    a des! or table

  • 8/19/2019 Computing Fundamentals Slides

    47/127

    @hat is a note3oo2

    computerH

    #&

    4ortable. small enough to fit on

    your lap1% lbs to 6 lbs 2

    "lso called a laptop

    5enerally more e-pensive than

    a des!top computer

  • 8/19/2019 Computing Fundamentals Slides

    48/127

    @hat is a ta3let PCH

    #'

    Resembles a letter0si7ed slate "llows you to write on the screen

    using a stylus

    Smaller version is the modularcomputer

    #hat are #eb0enabled handheld computers$

    "llow you to chec! e0mail and access the nternet 0e"/ena"led telephone is a :smart phone;

  • 8/19/2019 Computing Fundamentals Slides

    49/127

    @hat is a personal digital assistant :P!A;H

    #(

    4rovides personal organi7er functions

    Calendar

    "ppointment boo!  "ddress boo! 

    Calculator

    8otepad

  • 8/19/2019 Computing Fundamentals Slides

    50/127

    @hat t'pes o* serers are thereH

    $)

    Midrange server 4owerful. large

    computer that supports up to a few

    thousand computers

    Mainframe  9ery powerful.e-pensive computer that supports

    thousands of computers

    Supercomputer  The fastest. most

    powerful. most e-pensivecomputer& Used for applications

    requiring complex mathematical

    calculations

  • 8/19/2019 Computing Fundamentals Slides

    51/127

    @hat are fe categories o* computer usersH

    $

    Home mall %ffice<

    Home %ffice (%H%)

    'o"ile

    -arge usiness !ower  

  • 8/19/2019 Computing Fundamentals Slides

    52/127

    @hat so*t+are is aaila3le *or a home userH

    $

    •   Web access

    •   Entertainment

    •   Communications

    •   Personal finance management

  • 8/19/2019 Computing Fundamentals Slides

    53/127

    @hat so*t+are is aaila3le *or a small

    oce)home oce :S#?#; userH

    $

    :ocal area networ! 1:"82

    4roductivity software

    Specialty software

    #eb usage

    E0mail

  • 8/19/2019 Computing Fundamentals Slides

    54/127

    @hat is aaila3le *or

    a mo3ile userH

    $

    Hardware

    Software

    4roductivity 4resentation

    4ersonal

    information

    manager

    3ote"ook

    computers

    Handheld computers

    0e"/ena"led

    cellular phones

  • 8/19/2019 Computing Fundamentals Slides

    55/127

    @hat are the needs o* the large 3usiness userH

    $

    #eb access 4ublic !ios!  Telecommuting 8etwor! 4roductivity software

    Scheduling

  • 8/19/2019 Computing Fundamentals Slides

    56/127

    @hat are the needs o* a po+er userH

    $

    Speed and large amounts of storage

    Types of power users

    Engineers

    "rchitects

    Des!top publishers

    5raphic artists

  • 8/19/2019 Computing Fundamentals Slides

    57/127

    @hat are some e-amples

    o* computer applicationsin societ'H

    $

    Education ;inance

    5overnment Healthcare Science

    4ublishing

    Travel ndustry

  • 8/19/2019 Computing Fundamentals Slides

    58/127

    @hat are in*ormation s'stem elements H

    $

    4eople 4rocedures Data Software

    Hardware

    tep 7.

    !eople

    developprocedures

    for processing

    data

    tep 8.

    !eople use software to

    enter data intocomputer (hardware)

    tep 9.

    oftware processesdata and directs

    hardware to store and

    or output information

  • 8/19/2019 Computing Fundamentals Slides

    59/127

    Dataase'a very large0 integrated

    collection o& data- Models a real1world enterprise

    ◦  Entities 2e-g-0 teams0 games3◦  Relationships

    2e-g-0 student grade and marks3

    ◦  More recently0 also includes activecomponents 0 o&ten called 4usiness logic5-

    2e-g-0 ranking system3

    A Database Management System (DBMS) is aso&tware system designed to store0 manage0and &acilitate access to dataases-

  • 8/19/2019 Computing Fundamentals Slides

    60/127

  • 8/19/2019 Computing Fundamentals Slides

    61/127

    #rom #riendster.com on/line tour 

  • 8/19/2019 Computing Fundamentals Slides

    62/127

  • 8/19/2019 Computing Fundamentals Slides

    63/127

    %airl' sophisticated search aaila3le

    cra+ler indexes pages on the +e3◦ "e'+ord3ased search *or pages

    But, currentl'

    ◦ data is mostl' unstructured and unt'ped

    ◦ search onl'4 canJt modi*' the data canJt get summaries, comple- com3inations o* data

    ◦ *e+ guarantees proided *or *reshness o* data,consistenc' across data items, *ault tolerance, K

    ◦ @e3 sites t'picall' hae a !BMS in the 3ac2ground toproide these *unctions.

     The picture is changing◦ Semantic @e3 can help data modeling

    ◦ 5esearch groups :e.g., at Ber2ele'; are +or2ing onproiding some o* this *unctionalit' across multiple websites.

  • 8/19/2019 Computing Fundamentals Slides

    64/127

     Thought E-periment 94

    ◦ ou and 'our pro/ect partner are editing thesame fle.

    ◦ ou 3oth sae it at the same time.

    ◦ @hose changes surieH

    =

    6hought E7periment 8'

     9ou:re updating a ;le-

    6he power goes out-

    ours ) !artners +) oth 1) 3either  E) ???

    A) All ) 3one +) All ince -ast ave 1) ???

  • 8/19/2019 Computing Fundamentals Slides

    65/127

    A ma/or part o* the so*t+are industr'4◦ #racle, IBM, Microso*t, S'3ase

    ◦ also In*ormi- :no+ IBM;, Teradata

    ◦ smaller pla'ers4 /aa3ased d3ms, deices, ##, K

    Lots o* related industries◦ data +arehouse, document management, storage,

    3ac2up, reporting, 3usiness intelligence, appintegration

    #pen Source coming on strong◦ M'SNL, PostgreSNL, Ber2ele'!B

    ?

  • 8/19/2019 Computing Fundamentals Slides

    66/127

    Shi*t *rom computation to information

    ◦ al+a's true *or corporate computing◦ @e3 made this point *or personal computing

    ◦ more and more true *or scientifc computing

    (eed *or !BMS has e-ploded in the last 'ears

    ◦ Corporate4 retail s+ipe)clic2streams, Ocustomer

    relationship mgmt, Osuppl' chain mgmt, Odata+arehouses, etc.

    ◦ Scientifc4 digital li3raries, ?uman $enome pro/ect,Planet Earth, ph'sical sensors, grid ph'sics net+or2

    !BMS encompasses much o* CS in a practical discipline

    ◦ #S, languages, theor', AI, multimedia, logic

    ◦  et traditional *ocus on real+orld apps

    ?

  • 8/19/2019 Computing Fundamentals Slides

    67/127

    >ie+s descri3e ho+users see the data.

    Conceptual schemadefnes logicalstructure

    Ph'sical schema 

    descri3es the flesand inde-es used.

    !hysical chema

    +onceptual chema

    4iew 7 4iew 8 4iew 9

    1

    6sers

  • 8/19/2019 Computing Fundamentals Slides

    68/127

    Conceptual schema4

    ◦  Students( sid: string, name: string,login: string, age: integer, gpa:real)

    ◦  Courses( cid: string, cname:string,credits

    :integer)◦  Enrolled( sid:string, cid:string,

    grade:string) E-ternal Schema :>ie+;4

    Course_info( cid:string,  enrollment:integer)

    !hysical chema

    +onceptual chema

    4iew 7 4iew 8 4iew 9

    1

    These layers

  • 8/19/2019 Computing Fundamentals Slides

    69/127

    A t'pical !BMS has ala'ered architecture.

    Each data3ases'stem has its o+n

    ariations.

    @uery %ptimi&ation

    and Eecution

    elational %perators

    #iles and Access 'ethods

    uffer 'anagement

    1isk pace 'anagement

    1

    must consider

    concurrency

    control and

    recovery

  • 8/19/2019 Computing Fundamentals Slides

    70/127

    Ecient data access !ata integrit' securit' !ata administration Concurrent access, crash recoer'

    5educed application deelopment time So +h' not use them al+a'sH

    ◦ E-pensie)complicated to set up maintain

    ◦  This cost comple-it' must 3e oset 3' need

    ◦ $eneralpurpose, not suited *or specialpurpose tas2s :e.g.

    te-t search;

  • 8/19/2019 Computing Fundamentals Slides

    71/127

    !BMS endors, programmers◦ #racle, IBM, MS, S'3ase, K

    End users in man' felds

    ◦ Business, education, science, K !B application programmers

    Build enterprise applications on top o* !BMSs◦ Build +e3 serices that run o !BMSs

    !ata3ase administrators :!BAs;

    ◦ !esign logical)ph'sical schemas

    ◦ ?andle securit' and authori&ation

    ◦ !ata aaila3ilit', crash recoer'

    ◦ !ata3ase tuning as needs eole

  • 8/19/2019 Computing Fundamentals Slides

    72/127

    !BMS used to maintain, Quer' large

    datasets.◦ can manipulate data and e-ploit semantics

    #ther 3enefts include4◦ recoer' *rom s'stem crashes,

    ◦ concurrent access,

    ◦ Quic2 application deelopment,

    ◦ data integrit' and securit'.

  • 8/19/2019 Computing Fundamentals Slides

    73/127

    !BAs, !B deelopers the3edroc2 o* the in*ormationeconom'

      DBMS R>D represents a road0

      &undamental ranch o& the scie  o& computation

  • 8/19/2019 Computing Fundamentals Slides

    74/127

    Pro3lem defnition Method :ho+ to sole it;

    ◦ Algorithm

    ◦ !ata structure

    ◦ >erifcation *or correctness

    ◦ Anal'sis *or ecienc'

    Coding in gien Oprogramming language Understanding o* computer Oarchitecture

    OCompilation, Otesting, Ode3ugging !ocumentation

  • 8/19/2019 Computing Fundamentals Slides

    75/127

    Most dicult 5eQuires interaction 3et+een Oprogrammer

    and user Specs include4

    ◦ Input data  T'pe, accurac', units, range, *ormat, location, seQuence

    ◦ Special s'm3ols to signal end o* data

    ◦ #utput data :results; t'pe, accurac', units, range, *ormat, location, Oheadings

    ◦ ?o+ is output related to input

    ◦ An' special constraint

    E-ample4 Ofnd the phone no. o* a person Pro3lems get reised o*ten

  • 8/19/2019 Computing Fundamentals Slides

    76/127

    It is the process o* planning a seQuence o*steps :called instructions; *or a computer to*ollo+.

      E! 7

      E! 8

      E! 9

      . . .

  • 8/19/2019 Computing Fundamentals Slides

    77/127

    ?o+ !o @e @rite a ProgramH◦ A computer is not intelligent.

    ◦ A computer *rees people *rom repetitie and3oring tas2s.

    Li*e C'cle Phases◦ Pro3lemSoling Phase

    ◦ Implementation Phase

    ◦ Maintenance Phase

     This series o* stages is 2no+n as theO+ater*all model o* so*t+are deelopment.

  • 8/19/2019 Computing Fundamentals Slides

    78/127

    A(ALRE the pro3lem and SPECI% +hat thesolution must do.

    !eelop a $E5(AL S#LUTI#( :Algorithm; to

    sole the pro3lem.

    >E5I% that 'our solution reall' soles thepro3lem.

  • 8/19/2019 Computing Fundamentals Slides

    79/127

    @hat Is an AlgorithmH◦ A step 3' step procedure *or soling a pro3lem in

    a fnite amount o* time.

     The heart o* the programming process.

    ?o+ do 'ou start 'our carH

    A*ter 3eing satisfed +ith the algorithm, +etranslate it into a programming language.

  • 8/19/2019 Computing Fundamentals Slides

    80/127

    A set o* rules, s'm3ols, and special +ordsused to construct a computer program.

  • 8/19/2019 Computing Fundamentals Slides

    81/127

     Translating 'our algorithm into aprogramming language is called coding.

    ◦ (o single +a' to implement an algorithm.

    @ith CGG, +e use4◦ !ocumentation  'our +ritten comments

    ◦ Compiler  translates 'our program into machinelanguage

    ◦ Main Program ma' call su3algorithms

  • 8/19/2019 Computing Fundamentals Slides

    82/127

     TESTI($ 'our program means running:e-ecuting; 'our program on the computer,to see i* it produces correct results.

    I* it does not, then 'ou must fnd out +hat is+rong +ith 'our program or algorithm andf- itthis is called de3ugging

  • 8/19/2019 Computing Fundamentals Slides

    83/127

    USE and M#!I% the program to meetchanging reQuirements or correct errorsthat sho+ up in using it.

    Maintenance 3egins +hen 'our program isput into use and accounts *or the ma/orit'o* eort on most programs.

  • 8/19/2019 Computing Fundamentals Slides

    84/127

    Pro3lemSoling Phase◦ Anal'sis and Specifcation

    ◦ $eneral Solution :Algorithm;

    ◦ >eri*'

    Implementation Phase◦ Concrete Solution :Program;

    ◦  Test

    Maintenance Phase

    ◦ Use◦ Maintain

  • 8/19/2019 Computing Fundamentals Slides

    85/127

  • 8/19/2019 Computing Fundamentals Slides

    86/127

    $%A-

    HI3I3$+%1E

    E4IEE4IE

    E4IE

    1E6$

    1E6$

    1E6$

    E

    +%1E (  h o r t

     c u t ?

  • 8/19/2019 Computing Fundamentals Slides

    87/127

    Is (#T porta3le

    5uns onl' on a specifc t'pe o* computer

    Is made up o* 3inar'coded instructions:strings o* 1s and 9s;

    Is the language that can 3e directl' used 3'the computer

  • 8/19/2019 Computing Fundamentals Slides

    88/127

  • 8/19/2019 Computing Fundamentals Slides

    89/127

    A5E porta3le

    User +rites a program in a language similar tonatural language

    E-amples4◦ %#5T5A(

    ◦  A>A

    ◦ CGG

    Most are standardi&ed 3' IS#)A(SI to proidean ocial description o* the language

  • 8/19/2019 Computing Fundamentals Slides

    90/127

    other code&rom liraries0

     etc-

    other code&rom liraries0

     etc-

    written inmachinelanguage

    written inmachine

    language

    written in

    machinelanguage

    written in

    machinelanguage

    written in

    C**

    written in

    C**

    via compiler via lin!er

    SO3RCE O)

  • 8/19/2019 Computing Fundamentals Slides

    91/127

    A seQuence is a series o* statements thate-ecute one a*ter the other

    Selection :3ranch; is used to e-ecute dierent

    statements depending on certain conditions.

    Looping :repetition; is used to repeatstatements +hile certain conditions are met.

    A su3program is used to 3rea2 the program intosmaller units.

  • 8/19/2019 Computing Fundamentals Slides

    92/127

     Statement  Statement  Statement & & &

  • 8/19/2019 Computing Fundamentals Slides

    93/127

    I% Condition T?E( Statement9 ELSEStatement<

     

    Statement,

     

    Stateme

    nt

     

    Statement%

    Condition & & &

     T r u e

    ; a l s e 

  • 8/19/2019 Computing Fundamentals Slides

    94/127

    @?ILE Condition !# statement9

    Statement

    Condition& & &;alse

    T  r  u e 

  • 8/19/2019 Computing Fundamentals Slides

    95/127

    S3)4RO5R"M, & & &

    S3)4RO5R"M,

      a meaningful collection

      of SE?3E8CE.  SE:ECTO8. :OO4.

    S3)4RO5R"M

  • 8/19/2019 Computing Fundamentals Slides

    96/127

    As2 Nuestions a3out the data, the process, theoutput, error conditions.

    Loo2 *or *amiliar things certain situations arise

    again and again.

    Sole 3' Analog' it ma' gie 'ou a place tostart.

    Use MeansEnds Anal'sis !etermine the I)#and then +or2 out the details.

  • 8/19/2019 Computing Fundamentals Slides

    97/127

    !iide and ConQuer 3rea2 up largepro3lems into managea3le units

    Building Bloc2 approach sole small pieces

    o* the pro3lem

    Merge Solutions instead o* /oining themend to end to aoid duplicate steps.

    #ercome mental 3loc2 3' re+riting thepro3lem in 'our o+n +ords.

  • 8/19/2019 Computing Fundamentals Slides

    98/127

    It is a fnite set o* instructions +hich, i**ollo+ed accomplish a particular tas2.

    It is 3asicall' used to descri3e apro3lem soling method suita3le *orimplementation as a computerprogram.

    Algorithm is independent o* themachine and language used *orimplementation.

  • 8/19/2019 Computing Fundamentals Slides

    99/127

    Input Rero or more Quantities are supplied

    e-ternall' #utput At least one Quantit' is produced

    !efniteness Each instruction is clear unam3iguous %initeness It terminates a*ter fnite steps

    Eectieness Each instruction is simple to 3e carried out

    manuall'.

  • 8/19/2019 Computing Fundamentals Slides

    100/127

    An Ounam3iguous specifcation o* a method Is characteri&ed 3'4

    ◦ #rdered seQuence o* +elldefned, eectie

    operations that, +hen e-ecuted, +ill produce a resulta*ter Oterminating +ithin a fnite no o* steps

  • 8/19/2019 Computing Fundamentals Slides

    101/127

    @elldefned and eectie

    (o am3iguit', a method must e-ist

    $ood E-amples4

    Add 9 to -

    compute largest prime no. 911

    compute sQuare root o* - to 6 decimalplaces

    Bad e-amples4

    diide 91 3' -

    compute largest primecompute sQuare root o* -

  • 8/19/2019 Computing Fundamentals Slides

    102/127

    Al+a's terminate, and 3e sure a3out it Produce correct results

    ◦ this ma' reQuire some hard thin2ing

    ◦ testing helps, 3ut is not adeQuate

  • 8/19/2019 Computing Fundamentals Slides

    103/127

    Basic dierences are4◦ Program is +ritten in programming

    language +hereas algorithm is in

    English li2e pseudo language.◦ Program ma' 3e non terminating :#S;

    +hereas algorithm should terminate infnite steps.

  • 8/19/2019 Computing Fundamentals Slides

    104/127

    Stud' o* algorithm can 3eclassifed in *our distinct areasnamel' ho+ to

     deise◦  e-press

    ◦  alidate

    ◦  anal'&e algorithms

    Devising good algorithm4

  • 8/19/2019 Computing Fundamentals Slides

    105/127

    Devising good algorithm4◦ 5eQuires stud' o* arious design techniQues

    ◦  Top do+n, 3ottom up and o3/ect oriented

    approaches Expressing an algorithm4

    ◦ $ood algorithms are e-pressed using principle o*structured programming

    Validation of algorithm:◦ It should 3e alidated *or correctness o* all possi3le

    legal inputs. :correct, incorrect, e-ceptions;

    ◦ (ote that algorithm need not 'et 3e e-pressed as a

    computer program.

    Analysis of an algorithm:

  • 8/19/2019 Computing Fundamentals Slides

    106/127

     Analysis of an algorithm:◦ Stud' o* 3ehaior pattern or per*ormance

    profle.◦ It can 3e calculated in terms o* computing

    time and space reQuirement in themachine.

    6ime Comple7ity4 5unning time o* the

    program as a *unction o* the si&e o* input.

    Space Comple7ity4 Amount o* computermemor' reQuired during the programe-ecution.

  • 8/19/2019 Computing Fundamentals Slides

    107/127

    In topdo+n model, an oerie+ o*the s'stem is *ormulated, +ithoutgoing into detail *or an' part o* it.

    Each part o* the s'stem is thenrefned in more details.

    Each ne+ part ma' then 3e refnedagain, defning it in 'et more details

    until the entire specifcation isdetailed enough to alidate themodel.

  • 8/19/2019 Computing Fundamentals Slides

    108/127

     This design model can also 3eapplied +hile deeloping algorithm.

    It 3asicall' re*ers to successierefnement o* the pro3lem :tas2;into su3 pro3lems :su3tas2s;.

    5efnement is applied until +e reach

    to the stage +here the su3tas2s can3e directl' carried out.

  • 8/19/2019 Computing Fundamentals Slides

    109/127

    su"task7 su"task8 su"task9

    'ain ask

  • 8/19/2019 Computing Fundamentals Slides

    110/127

    In ottom1up design indiidual partso* the s'stem are specifed in details.

     The parts are then lin2ed together to

    *orm larger components, +hich are inturn lin2ed until a complete s'stem is*ormed.

    #3/ectoriented languages such asCGG or A>A use 3ottomup approach+here each o3/ect is identifed frst.

  • 8/19/2019 Computing Fundamentals Slides

    111/127

  • 8/19/2019 Computing Fundamentals Slides

    112/127

    It is a techniQue using +hich one can +ritealgorithms :programs; in top do+n *ashion. This techniQue should 3e used +ith eer'

    leel o* refnement.

    In SP, one entr' and one e-it principle isadopted in all the constructs.

    Basicall' there are three structures in SP

  • 8/19/2019 Computing Fundamentals Slides

    113/127

    Se?uential 2se?uence3

      entr'

      T9

     T<

     e-it

    Selection 2test3

  • 8/19/2019 Computing Fundamentals Slides

    114/127

    Selection 2test3  I* cond  then task

      !   Cond tas29

     

    "

    I* cond  then task else task#

      tas2< " Cond !tas29

     

    Repetition

  • 8/19/2019 Computing Fundamentals Slides

    115/127

    p

    @hile@hile :cond; do

      end+hile

    !o +hile )5epeat  !o

      +hile :cond;

  • 8/19/2019 Computing Fundamentals Slides

    116/127

    #rdered seQuence

    ◦ T9, T

  • 8/19/2019 Computing Fundamentals Slides

    117/127

    ◦  T9, T

  • 8/19/2019 Computing Fundamentals Slides

    118/127

    @hat is the dierence 3et+een4

    7

    8

    9

    +

    7

    8

    9

    +

     >

     >

  • 8/19/2019 Computing Fundamentals Slides

    119/127

    Computation o* income ta- $ien a ta- ta3le as 3elo+, compute the ta-, T, on

    an income, .

    ?ere is an algorithm4

    tep 7* Input I3+C

    tep 8* +ompute ta, C

    tep 9* %utput

    +C-/ 0A1

    ) 23 +C 23*))))) )

    *))))* 23 +C 23))))) ) 4 ).*)56+C7*)))))8))))* 23 +C 23"))))) *)))) 4 ).)56+C7)))))8

    "))))* 23 +C ")))) 4 ).")56+C7")))))8

  • 8/19/2019 Computing Fundamentals Slides

    120/127

    tep 7* Input I3+C

    tep 8a* if I3+ D 9then 9 F .9G(I3+/9)C

    tep 8"* if I3+ D 8 and I3+ 9

     then 7 F .8G(I3+/8)C

    tep 8c* if I3+ D 7 and I3+ 8

     then F .7G(I3+/7)C

    tep 8d* if I3+ 7 then C

    tep 9* %utput

  • 8/19/2019 Computing Fundamentals Slides

    121/127

     Ta3le loo2up4 Consider4◦ special 2e' ",

    ◦ length o* list, = or (, more generall'

    ◦ unsorted L V W:-9, '9;, :-

  • 8/19/2019 Computing Fundamentals Slides

    122/127

    ?ere is refned ersion o* the algorithm4

    Input C

    Input (7, y7)C

    Input (8, y8)C

    Input (9, y9)C

    Input (, y)CInput (B, yB)C

    If = 7 then output (7, y7)C

    If = 8 then output (8, y8)C

    If = 9 then output (9, y9)C

    If = then output (, y)CIf = B then output (B, yB)

  • 8/19/2019 Computing Fundamentals Slides

    123/127

     This algorithm does the same thing, e-ceptthat it is compact4

    Input C

    epeat these operations B times*

    Input (, y)CIf = then output (, y)

    J

  • 8/19/2019 Computing Fundamentals Slides

    124/127

    An een 3etter algorithm4

    Input nC

    If n D then

    Input Cepeat these operations n times*

    Input (, y)C

    If = then output (, y)

    J

    J

  • 8/19/2019 Computing Fundamentals Slides

    125/127

    Use Fo+charts to isuali&e the +or2ing o* analgorithm

    %or e-ample4

    7

    8

    9

    +

    true

    false

    start

    stop

    #rolem @'%ind the roots o* a Quadratic eQuation o* the* Y < G 3Y G 1

  • 8/19/2019 Computing Fundamentals Slides

    126/127

    *orm aY-

  • 8/19/2019 Computing Fundamentals Slides

    127/127

    Formula' 

    *act V n Y n9 Y n< Y KY <Y 9

    Algorithm'

    input nD

    i V 1D initiali$ation*act V 9D

    looping

    +hile :i n;

    Z i V i G 9D

    *act V i Y *actD

    [

    E7ecution

    Let n V 6Di V 1D *act V 9D

    %hile loop

    1 6D i V i G9V9D *act V 9 Y9D

    9 6D i V i G9V