INFSCI 0015 Data Structures Lecture 0: Programming - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

INFSCI 0015 Data Structures Lecture 0: Programming

Description:

Run all examples, modify it. Solve problems, check yourself on quizzes. Books. Books for C ... Home page (picture!) - up to 4pt. Try visible features, ask ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 24
Provided by: peterbru
Category:

less

Transcript and Presenter's Notes

Title: INFSCI 0015 Data Structures Lecture 0: Programming


1
INFSCI 0015 - Data StructuresLecture 0
Programming
  • Peter Brusilovsky
  • http//www2.sis.pitt.edu/peterb/0015-011/

2
INFSCI 0015 and BSIS
  • Information Science
  • Data Structures
  • Information Science and programming
  • So, do we need to learn a programming language?
  • To understand it, you have to do it!
  • No magic in programming!

3
What is special for INFSCI 0015
  • Programming and Data Structures
  • Double the content CS1 and CS2
  • Data Structures is the goal
  • Language is the tool
  • Double load?
  • Regular load for students familiar with
    programming (36)
  • Much more work for beginners (39, 312)

4
Why C?
  • Modular procedural language with arrays,
    structures, and references
  • C vs. Pascal
  • modern, portable, better textbooks and tools
  • employment prospects (C, C, Java)
  • C vs. C or Java
  • small, clean, simple
  • can support learning data structures without
    learning too much language extras

5
Learning C
  • Be careful, read your programs!
  • The basic philosophy of C "programmers know
    what they are doing" - KR2, p.3
  • Ask questions in CourseWeb forums
  • Meet TAs and your instructor during the office
    hours
  • Practice, practice, practice!
  • Run all examples, modify it
  • Solve problems, check yourself on quizzes

6
Books
  • Books for C
  • Deitel and Deitel (DD)
  • Kernighan and Ritchie (KR2)
  • Extra books
  • Multiple free tutorials on the Web
  • Books for Data structures
  • Gilberg and Forouzan
  • Other books

7
Course Tools
  • All information will be provided via course home
    pages (http//www2.sis.pitt.edu/peterb/0015-011/
    )
  • BlackBoard system will be used as a course tool
    for
  • Posting announcements (WATCH IT!)
  • Posting course materials, assignments, quizzes
  • Learning about and communicating with each other
  • Asking questions and getting answers
  • Submitting assignments
  • Viewing grades and feedback
  • Other tools could be introduced on later stages

8
A Few Words on Logistics
  • Final grade 403030
  • To get credit submit homework before or on the
    due date
  • Catch up early
  • Get books, ask questions, seek help
  • Run examples, experiment, write
  • Activity counts
  • Be active in forums, answer questions
  • Waiting list

9
CourseInfo
  • CourseInfo system will be used as a course tool
    for
  • Posting course materials, assignments, and
    quizzes
  • Learning about and communicating with each other
  • Asking questions and getting answers
  • Submitting assignments
  • Viewing grades and feedback
  • Other tools could be used on later stages

10
Communication
  • To you
  • Watch closely the CourseInfo site for
    announcements.
  • Check your CIS mail regularly - most important
    and urgent information will be send to it
  • From you
  • If a question is not personal (an answer could be
    useful for others) - ask via forum
  • If it is a personal question - ask me or TA by
    e-mail (can do it from CourseInfo too)
  • Waiting list

11
CourseInfo Assignment
  • Due Tuesday 9/6/01
  • Home page (picture!) - up to 4pt
  • Try visible features, ask questions, answer
    questions (done?)
  • Complete C Pre-test - results are not counted
    towards your grade
  • Submit test message to the test forum

12
What are computers?
  • idiot servants that can do simple operations
    incredibly fast if you tell them every step to do
  • like little children in their need for specific
    and detailed instruction
  • computers are not brains are not smart -
    they only as good as the program they are running

Adapted from J. Wyatt s slides
13
Programs and programming
  • What is a program?
  • A set of instructions working with data designed
    to accomplish a specific task
  • The recipe analogy
  • Ingredients are the Data
  • Directions are the Program Statements
  • What is programming
  • The art and craft of writing programs
  • The art to control these idiot servants and
    naïve children

14
Commands and data
  • Components of a program
  • Data
  • Commands (instructions)
  • This is true on several levels
  • Basic features of a machine language or a
    programming language
  • Ways to represent information - data types
  • Ways to act on information - operations

15
Information Representation
  • Computer store information digitally in binary
    format
  • Ultimately everything is ones and zeroes
  • characters, numbers
  • instructions (programs!!)
  • pictures, video
  • Binary arithmetic E.g., 7 00000111
  • 99 01100011

16
From Commands to Algorithms
machine commands
0100 0001101 10001110
high-level language commands
a 16
printf("Hello!\n)
basic control structures
while for if-else switch
average
maximum
string reading
simple patterns
algorithms
sorting
binary search
matching
17
C Program Syntax
  • Most C programs have the following (at minimum)
  • main (program arguments)
  • ltone or more statementsgt
  • Every program must have a main function. Note
    that C is case sensitive (Main is not the same as
    MAIN or main).

18
Hello World Program
  • include ltstdio.hgt
  • main()
  • printf(Hello World!\n)

Dissection adapted From S. Pilachewski
19
Hello World - dissected
  • include ltstdio.hgt
  • main()
  • printf(Hello World!\n)
  • Directive which tells the compiler that the
  • standard input / output library will be
    used.

20
Hello World - main() Function
  • include ltstdio.hgt
  • main()
  • printf(Hello World!\n)
  • Execution of a C program always begins at the
    main() function. Every C program must have one
    (only one) main() function.

21
Hello World - the Braces
  • include ltstdio.hgt
  • main()
  • printf(Hello World!\n)
  • The open brace () marks the beginning of the
    function body, which is one or more program
    statements which perform some task.
  • The closing brace () marks the end of the
    function body.

22
Hello World - the printf statement
  • include ltstdio.hgt
  • main()
  • printf(Hello World!\n)
  • This statement is a function call to the printf
    function in the C Standard I/O Library. It
    displays the message which is the argument to the
    function. The \n denotes the newline.

23
Hello World - the semicolon
  • include ltstdio.hgt
  • main()
  • printf(Hello World!\n)
  • The semicolon marks the end of a C program
    statement.
Write a Comment
User Comments (0)
About PowerShow.com