Docsity

Introduction to Problem Solving and Programming Languages: Lecture Notes, Study Guides, Projects, Research of Programming Languages

Partial preview of the text

Download Introduction to Problem Solving and Programming Languages: Lecture Notes and more Study Guides, Projects, Research Programming Languages in PDF only on Docsity!

Lecture 01 INTRODUCTION TO PROBLEM SOLVING ANDPROGRAMMING LANGUAGES T EACHE R: DOAN T R UN G T UN G ( T UN GDT27@ FE. EDU.VN)

Objectives

Basic concepts of problem solving

Steps involved in program development

Top-down programming

Programming languages, their types, and features

PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Problem solving

It’s a creative process, it is an act of

Defining a problem  Determining the cause of the problem  Identifying, prioritizing, and selecting alternative for asolution  Implementing a solution PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Strategies for problem solving

There is no universal method for solving a given

problem

Different strategies are good for different problems

Some of the well-known strategies are

Divide and conquer  Greedy method  Dynamic programming  Backtracking  Branch and Bound PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Steps in ProgramDevelopment

The various steps involved are

Defining or Analyzing the problem  Design (Algorithm)  Coding  Documenting the program  Compiling and running the program  Testing and Debugging  Maintenance PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Analyzing or Defining theProblem

The problem is defined by doing a preliminary

investigation

Defining a problem helps us to understand

problem clearly

It is also known as Program Analysis

PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Specifying the inputrequirements

The input specification is obtained by answering

following questions

What specific values will be provided as input to theprogram?  What format will the values be?  For each input item, what is the valid range of values thatit may assume?  What restrictions are placed on the use of these values? PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Specifying the outputrequirements

The output specification is obtained by answering

the following questions

What values will be produced?  What is the format of these values?  What specific annotation, headings, or titles are requiredin the report?  What is the amount of output that will be produced? PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Activity: Find Factorial Number

Input?

Output?

Process?

PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Activity Find Factorial Number

Input

: Positive integer number

Output

: Factorial of that number

Process

: Solution technique which transforms

input to output. Factorial of a number can becalculated by the formula n!=123…n PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Main elements of use-case diagram PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Activity: Draw use-casediagram

You are hired to develop FAI’s library system withfollowing description -

Admin who could

Manage books, readers (staff, lecturers, and students), etc. - Manage borrow/return books

Users (staff, lecturers, students) who could

View/search books - Reserve books - Borrow/return books

Please draw Use-case diagram for this scenario

PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Modular Design

Once the problem is defined clearly, several

design methodologies can be applied

An important approach is Top-Down program

design

It is structured design technique

It breaks up the problem into a set of sub-problems calledModules  It creates a hierarchical structure of the modules PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES

Developing a solutiontechnique: Algorithm

An algorithm is a step-by-step description of the

solution to a problem

An algorithm must be

Definite  Finite  Precise and Effective  Implementation independent (only for problem not forprogramming languages) PROBLEM SOLVING & INTRODUCTION TO PROGRAMMING LANGUAGES