Save
CS
Chapter 1 Problem Solving
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Amisha
Visit profile
Cards (19)
What is an algorithm?
An algorithm is a
set
of
steps
that defines how a
task
is to be
performed.
What are the pros if an algorithm is successful?
its
accurate
,
consitent
and
effiecent
What is an example of an algorithm?
A
recipe
Sequence meaning
instructions
are one after the other
Selection
creates a
branch
Iteration
repeats instructions
What are these symbols?
Label
A)
Start/end
B)
input/output
C)
process
D)
decision
4
/
divide
//
divide
integer
only
*
multiply
%
modulus
-the
remainder
+
add
-
subtract
Pseudo-code
a structured,code-like language that can be used to describe an
algorithm
.
Linear Search
a simple
algorithm
and it's not subtle.Starts at the
beginning
and goes through until it finds the
number
.The
list
doesnt have ot be in
order.
Binary Search
divide and conquer
method
Binary search order
#1 List must be
ordered
2# Find the
median
of the list
3# If the
median
equals
the search item
stop.
4#If the median is too
high
,repeat with the sublist to the
left
5# If the
median
is too low,
repeat
with the sub-list to the
right
6#
Repeat
steps
2
to
5
until item is found
Bubble sort
arranges
numbers
from
smallest
to
largest
(ascending order)
Bubble sort order
1#Start at the
beginning
of the list
2#Compare the values in position
1
and in position
2
in the list-if they are not in
ascending
order then
swap
them.
3#Compare the values in position
2
and position
3
in the list and
swap
if necessary.
#4.Continue to the end of the list
#5If there have been any
swaps
,repeat steps
1
to
4.