Data Structure and Algorithm Reviewer 1
Data Structure and Algorithm Reviewer 1
REVIEWER
Compilation - execution of the translated code is
How does computer work? - A program makes usually faster. Only the user has to have the
a computer usable, can perform very complex compiler the end user may use the code without
task, but not innate (not built in). It should have a it.
hardware and software (software communicates
Interpretation – you can run the code as soon as
with hardware in program)
you complete it. No additional phases of
4 Basic units of computer - Input to CPU translation.
(processor) to Storage then store to memory then
DISADVANTAGES
output.
Software - set of program (set of instructions), Compilation – time consuming
program for processing - don’t expect interpretation to ramp up your code
Binary - language of machine Programming to high speed.
Multiple arguments - can put numbers - comma - Note: any digit raise to 0 is equal to 1
signifies another argument. - Add lahat ng na-compute
KEYWORD ARGUMENTS - Same goes sa hexa papalitan ng 16 yung
end - doesn’t go to another line ieexponent
sep - separate lines goes to the next line E or e - is exponent which is concise record of the
phrase times ten to the power of....
end and sep needs to be in the end of the line
- to get a high number we use E to get it (1billion
comma (,) - space = 1E9)
EX CODE: note: exponent values has to be integer base may
print("LAB", "KA", "BA") – uses comma be either integer or float
Boolean (True or False) – can’t be use if the
print("LAB","KA","BA?", sep="***",end="...")
start is in lowercase - (True or False = / true or
print("LAB AKO", end="!!!") false = X) - boolean always display the larger
value
KEYWORD ELEMENTS
(True > False = True) true = 1 false = 0
- identifying elements, an equal sign, value
assigned to that argument Basic operator - symbol of the programming
language
Literals - data itself - whose values are
determined by the literal itself (ex: 123) (ex: c) - - + (addition)
use to encode data and to put them into your
code.
- - (subtraction)(it can change the sign of the - the name of the variable must not be any
number unary way) (binary – exact) Python’s reserved words.
- / (division) EX VARIABLES (correct)
- * (multiplication) - MyVariable, i, I, t34, Exchange_Rate, counter,
days_to_christmas, The
- // (floor division – exact value/rounded off)
NameIsTooLongAndHardlyReadable, _
ex: 0.5 = 0, -0.5 = -1 KEYWORDS/RESERVED WORDS OF
- % (remainder/modulo) PYTHON:
ex: 6%4 = 2 (4-2=2) minus pag malapit lang - False, None, True, and, as, assert, break, class,
14%4=2 (14//4=3 then 3x4=12 then 12-14=2) continue, def. del, elif, else, except, finally, for,
when the divisor is bigger then the dividend (first from, global, if, import, in, is, lambida, nonlocal,
term) is the answer. not, or, pass, raise, return, try, while, with, yield
- ** (exponent)
LIST OF PROPERTIES (ranking/similar to HOW TO CREATE A VARIABLE
PEMDAS but in python way)
var = 1
1. **
account_balance = 1000.0
2. +, - (unary)
client_name = 'Juan Dela Cruz'
3. /, *, %
print(var, account_balance, client_name)
4. +, - (binary)
print(var)
BINDINGS - determines the order of the
operation
SECTION REVIEW
- when using remainder(%) its left to right
- Literals are notations for representing some
- when using exponent(**) its right to left
fixed values in code.
- when in the same priority its left to right - The binary system is a system of numbers that
EXAMPLE: employs 2 as the base.
print ((5*((25%13)+100)/(2*13))//2) - Integers (or simply ints) are one of the numerical
types supported by Python.
25%13 = 1 x 13 = 25 – 13 = 12
- Floating-point numbers (or simply floats) are
2*13 = 26 another one of the numerical types supported by
print ((5*(12+100)) / (26)//2) Python
else: EXAMPLE:
if next_condition: Enter: **
next_true_condition Exponential
else: Enter: 6
EXAMPLE:
for i in range(2, 8):
print("The value of i is currently", i)
RESULT:
The value of i is currently 2
The value of i is currently 3
The value of i is currently 4
The value of i is currently 5
The value of i is currently 6
The value of i is currently 7