0% found this document useful (0 votes)
16 views16 pages

2022-11-18 Ads With Java - Day 1

The document discusses problem solving, computational thinking, algorithms, and data structures. It defines problem solving as developing a process to transform an input into an output. The key steps are to define the problem, identify possible solutions, decide on a solution, assign responsibilities, and take action. Computational thinking involves decomposition, pattern recognition, abstraction, and using algorithms to sequentially solve problems. The document then defines an algorithm and data structures, focusing on arrays as a linear data structure that stores elements sequentially in memory. It outlines the properties, advantages, and disadvantages of arrays.

Uploaded by

Saket Sahu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views16 pages

2022-11-18 Ads With Java - Day 1

The document discusses problem solving, computational thinking, algorithms, and data structures. It defines problem solving as developing a process to transform an input into an output. The key steps are to define the problem, identify possible solutions, decide on a solution, assign responsibilities, and take action. Computational thinking involves decomposition, pattern recognition, abstraction, and using algorithms to sequentially solve problems. The document then defines an algorithm and data structures, focusing on arrays as a linear data structure that stores elements sequentially in memory. It outlines the properties, advantages, and disadvantages of arrays.

Uploaded by

Saket Sahu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Problem Solving

and
Computational Thinking
“Problem solving is a skill that can be developed via
practice”

• Define the Problem


• What exactly is the problem that we are trying to solve?

• Identify the Problem


• How and why did the problem happen?

• What are all the possible solutions?


• The ideal solution could be one of the many possible solutions.

• A decision is to be made.
• Any decision is usually better than no decision at all.
• Assign responsibility to carry out the decision.
• If a team then who will do what and when.
• If alone, still decide when are you going to do it

• Set a schedule.
• Without schedule and deadline, its just a discussion.

•Task self/someone else to take definite action to implement the


solution and resolve the problem.
Core Components of Computational Thinking

• Decomposition
• Break down complex problems into smaller, simpler problems.

• Pattern recognition
• Make connections between similar problems and experience.

• Abstraction
• Identify important information while ignoring unrelated or irrelevant details.

• Algorithms
• Creates sequential rules to follow in order to solve a problem.
Algorithm
and
Data Structures
Algorithm
• A “finite sequence” of “well defined” computational steps that transforms
“input” into the “output”.

• Basic constructs of an algorithm.


• Linear Sequence – statements that follow one after the other.
• Conditional – “if then else”
• Loop – sequence of statements that are repeated a number of times.
Data Structure
• A data structure is a way to store and organize data in order to facilitate
access and modifications.

• No single data structure works well for all purposes, and so it is important to
know the strengths and limitations of several of them.
-
Send a document to a friend .
→ address .

/→
file six
physical
doe '

↳ which document
text file

A document
type → doe file

↳ platform

linux
→ wind

document ?
to
on
which channel send

document to send
Soft copy A
internet .

→ Constraint by size .

via
↳ share
↳ storage .

Hard copy
↳ Fax
↳ postal service

space
Internet

iii.
>

7
Posted
Linear Data Structures
203
Vbt no 1 202 , ;

Array
,

0
int sum =
;

i
• Need for an array?
↳ need to sum sum + n°1 ;
when
=
we

sum -1202 ;
do same processing sum =

sum Sum +203 ;


on a set d- elements . =

-
wit E ] nos = -
- -

;
=:O ;
wit sum
:
+ + i]
I < - r
;
too Ci = 0
;

sum=sum+nosEEf-
Properties of Array
• Data Structure that stores multiple elements, all of the same type.

• All elements of an array are stored sequentially in memory, one after another.


newy.int#3--yg-Eg-Index1i--I
wit I] arr ;
Subscript .

am =

azo
Allocates memory
for 5 integers .

5;
asr IO] =

arr [ 13=10 ;
3 int

Pros and Cons of Array


0 2 2

÷t¥É¥an
away .

1000 ← Base address d-


• Advantages away ,

• Efficient lookup OR Random access.


• Efficient in adding and removing elements at the end of array arr -123

nt
A
Base add sent
• Disadvantages 2 * size A
• Fixed size. Resizing of array is inefficient. value stored
• Insertion and deletion of elements, in middle of array is inefficient. his Gooey .

new unit Is≥


[] an =

0 I 2 3 4 am [Count 3=55

FEI Count →

4×-2
•:É=
+ +
county
,

wit count = 0
;⇐ logical size of array .

↳ indicates how
elements are stored in
many
away .
Aorayo8 ☒③aw
new * ≥
ii.+ an =

5
am to] =
;
an [D= 105

any [232202
array
#
Problem as
← 3
-233=29 is only
.

an size

To solve : Resize array .

Create a
larger array
53¥10
.

cist [ from old


① wit I] t = new
elements
↳② Copy
to new .

away
[ <3 ; + +
for ( int [ = o
;

② t.IE] = an Ei}
original array Def
③ get
created array
newly
#
to
.

③ am =
ty
Inseotimmiddle-N-aorayw.it uist [5≥

to
am new
I] =

,H
aw [03=5 ;
ONE23=20
;

AN [ 23=10;
arr

?
count =3

+¥ʰ
Make space
¥
between
5£10 .
É÷?÷÷É!:
g- =

an
count -2;

Ij + ☐
size

=
.

ANE't≥
10 and all
By shifting j;
± .
- -

↳ a. }
"""" "
oisht an -1532 element, ++ count
place to .
,
0 I 2 3 72

FEE
arr

art

count A

sight
=

all
shift
t - →
elements to

Insert by 2 place .

7. in

spacecreatedgimnfmmiddleotamb.lt elements to left .

Shift

EÉImpmA→É
int count ,
Ent Insert Atpos ( wit I] art
① ,

int element);
A- logical wit pos ,
size d- away
New
/
.

② It Delete From Pos ( inst I] am


,
int count,

hilt Pos) ;
⑧ wit Delete Element ( int I] ans
,
Ent count
,

I
New
logical
,1 size A array . ↑ list element)j
occurrence
Delete first

/ A "
element
"
from array ,

wit Count
Delete All Element ( List I] arr
,
It
,

⊕ t ,
int element ,
all
Delete "

d-
" element
occurrences
array
from
.

You might also like