CH 1 - PROBLEM SOLVING (Module 1) Flashcards

1
Q

5 steps of problem solvin cycle

A
  1. analyzin the problem
    i. understand the problem well
    ii. amalyze the problem
  2. developin an alorithm
    i. think of possible solutions
    ii. follow a modular approavh
    iii. identify operations for solutions
  3. codin
    i. code program using appropriate control structures
  4. testin and debuin
    i. test and debu
    ii. complete your documentation
  5. maintaining and implementin
    i. implement your code
    ii. maintain your proram
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is codin

A

codin is the technical word fro writin a proram. thji step is to translate the aloritm into a prora,min lanuae

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

testin

A

estin is the process of findin errors in the proram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

debuin

A

the process of correctin errors found durin the testin process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

documentation

A

it is intended to allow another person or prorammer to understand the proram at a later date
miht also conain a adetrailedx description of what the proram does and how to use the proram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

maintainin a aproram

A

involves modifiyin the prorams to emove previuouly undetected errors, to enhance the proram with different features or functionality, keepin the proram up to date with ivernment reukationso rcompany policies

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

decomposition

A

the process of breakin down a bi or complex problems into a set of smaller sub processes to allow us to describe, understand or execute the problem better
2. breakin a lare problem into more manaeable sub problems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does decomposition involve

A
  1. dividin a task into a sequence of subtasks

2. identifyin elemts or parts of a complex system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is the need of decomposition

A

lare problems are disproportionately harder to solve than smaller problems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

algorithm

A

the set of rules that define how a particular problem can be solved in finite number of steps
-contains finite steps each of which may require one or more operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

constraints on type of operations an alorithm van include

A
  1. each operation must be DEFINITE
    - must be clearly defined what should be done
    - cant say add 3 and a, since the operation is not defined
  2. each operation must be EFFECTIVE
    - each step should also be able to be done by pen and paper in finite amount of time
    - arithmetic operators on interes are effective but on real numbers, its not effective
    since vales come in infinitely lon decimal expansions
  3. each operation must be FINITE
    - the alorithm should terminate after a finite number of operations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

characteristics of a good algorithm

A
  1. PRECISION - steps should be precisely define
  2. UNIQUENESS - every step should uniquely contribute to the algorithm
    - result of a step is unique and depends on input and the results of the previous steps before it ONLY
  3. FINITENESS - must be finite and should terminate
  4. INPUT - algorithm requires specific input to work on
  5. OUTPUT - algorithm produces output as per input received and stated objectivities
  6. OUTPUT -
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

components of an algorithm

A
  1. INPUT - provoided by user or elf obtained like readin from a file
  2. PROCESSIN -
  3. OUTPUT - the objective of the algorithm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

program and algorithm relation

A

a program is the expression of an algorithm in a prorammin lanuae

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

algorithm can be expressed in what ways

A
  1. FLOWCHART

2. PSEUDO - CODE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

FLOWCHART

A
17
Q

functions of flowcharts

A
  1. pictorially depicts the sequence in which instructions are carried out in an algorithm
  2. used as an aid in developing algorithms
18
Q

flowchart symbol - OVAL

A

start and stop

19
Q

flowchart symbol - PARALLELORAM

A

input and output

20
Q

flowchart symbol - RECTANLE

A

processin

21
Q

flowchart symbol - DIAMOND

A

decision box

22
Q

flowchart symbol - CIRCLE

A

connector ???

23
Q

—–>—- and upward arrow

A

flow of control symbol

24
Q

_
I
———-
I_

A

annotation

25
Q

pseudo code

A

it is an informal lanuae

  • helps programmers describe steps of a proram’s solution without usin any prorammin lanuae syntax
  • it is a text based detail alorihmic dein tool
  • creates an outline or rouh draftof a proram that ives the idea od how the alorithm works and how conrol flows from one step to another
26
Q

notes of pseudo code

A
  1. there are NO STANDARD RULES o write a pseudocode

2. TOTALLY INFORMAL WAY of representin an alortihm

27
Q

advantages of a pseudo code

A
  1. uses elish - easy to understand
  2. hih;hts the seuqnce of instructions
  3. structure of alorithm is clealry visible
    - for ex: selection and repetition blocks
  4. can be easily modified sinc no dependncies
28
Q

disadvantes of pseudo cod

A
  1. not a visual tool like flowchart
  2. no standardization - varies from coder to coder
  3. can only be tested on paper, no program to test it
  4. informal representation of an algorithm
29
Q

verifyin an alorithm means?

A

to ensure that the alorithm is workin as intended

- we should test an alorithm eith sample inputs for which we know the outputs

30
Q

DRY RUN

A

process of a prorammer manually workin throuh their code to trace the value of variables. no software involved in this process

31
Q

how is dry run done

A
  • print out of code
  • coder uses pen and paper and manually follow the value of a variable to check that it was used and updated as expected
  • if works incorrect, cder finds out error
32
Q

characteristics of a dry run

A
  1. carried out durin desin, implementation, testin or maintennace
  2. used to identify the logic error in a code
  3. cannot find the execution error in a code
33
Q

trace tables

A

used in dry run of code

- each line of codeis seen on the values of variables of the alorithm

34
Q

comparin alorithms main factor

A

to decde which alorithm to choose over, EFFICIENCY is the main factor

35
Q

major factors that overn the efficiency of an alorithm are

A
  1. th etime it takes to find the solution

2. the resources which are consumed in the process

36
Q

two type of efficiences that are decidin factors for chosin alorithms

A
  1. SPACE WISE EFFICIENCY - how much amt of memory the algorithm will take before it terminates
    - thus we consider the amt of data the alo uses when runnin
  2. TIME WISE EFFICIENCY - how muchtime alo takes to complete
    - this factor depends on:
    i. RAM available ii. prorammin lanuae iii. hardware platform etc