Title
- searching algorithms can be done in intervals or sequences
- sequencial search can take way too long
- binary search is most efficient for sorted lists
- for algorithms --> important to understand the question or what is asked
- we can use if else syntax for that in JS
sum = 24
counter = 5
for i in range (0, 25):
sum = sum + 2
counter = counter + 5
def squareroot(i):
if (i == 0 or i == 1):
return(i)
for x in range (1, 100):
if x*x:
return x
def collatz(int):
while int > 1:
if int % 2 == 0:
int = int / 2
print(int)
else:
int = (int * 3) + 1
print(int)
i = 45
print(collatz(i))