01_Introduction_to_Algorithms_and_DS (1)
01_Introduction_to_Algorithms_and_DS (1)
structures
INTRODUCTION
Data structure and algorithms 2
What is data?
Data is a collection of facts from which conclusion
may be drawn.
Types of data:
Textual, numeric, audio, picture, video, etc.
What is data structure? 3
Clearly identify:
what output is required?
what is the input?
What steps are required to transform input into output
A problem can be solved in many different ways
Which solution, amongst the different possible solutions
is the optimal?
Example 8
guidelines
Use PL constructs that are consistent with modern high-level
languages, e.g., C++, Java, ...
Use appropriate comments for clarity.
Be simple and precise.
Example: Determining 12
even/odd number
Input: range
for num=0; num<=range; num=num+1
if num % 2 = 0 then
print num is even
A number divisible by 2 is
considered an even number, while else
a number that is not divisible by 2 print num is odd
is considered an odd number. end if
end for