CS General Flashcards
Statically typed language
Type of a variable needs to be defined in advance and cannot be changed.
(E.g Golang => var counter int;)
Dynamically typed language
The type of variables is fluid. Languages include Python, Ruby, ..
my_var = 1
my_var = “string”
print(my_var)
Linear Complexity
O(n)
describes an algorithm who’s complexity will grow in direct proportion to the size of the input data. E.g. Linear search or an array.
Logarithmic complexity
O(log N)
logarithm of 8 for base 2 = log2(8) = 3
logarithm of 16 for base 2 = log2(16) = 4
-> input doubled, (8 to 16); but output only increased 1/3 (3 to 4)
Hamming Weight
The Hamming weight of a string is the number of symbols that are different from the zero-symbol of the alphabet used.
String Hamming weight 11101 4 11101000 4 00000000 0 678012340567 10
Most significant bit (MSB)
In a binary number, the bit furthest to the left is called the most significant bit (msb) and the bit furthest to the right is called the least significant bit (lsb)
The MSB gives the sign of the number (sign bit) , 0 for positive and 1 for negative
PEP
python
Python Enhancement Proposals
A PEP is a design document providing information to the Python community, or describing a new feature for Python or its processes or environment. The PEP should provide a concise technical specification of the feature and a rationale for the feature.
PEP 8 -> Style guideline by Guido van Rossum
TypeScript vs JavaScript
TS pros:
- Static typing (static declaration of variables)
- Improved readability
-
O(n^2)
Quadratic complexity
Exponential time complexity
O(2^n)
Interpreted Programming language
Interpreters run through a program line by line and execute each command. You write code for the interpreter, which is basically the same on every machine.
You always export the actual code to where ever the program is executed. No platform dependence, but everyone sees what the code constitutes of.
Humus recipe in ancient greek:
=> you have a friend who speaks greek sitting next to you who translates on the go
PHP, Ruby, Python, and JavaScript.
Compiled programming languages
Compiled languages are converted directly into machine code that the processor can execute. As a result, they tend to be faster and more efficient. They also give the developer more control over hardware aspects, like memory management and CPU usage.
Since you export a binary to where ever the program is executed, there is a platform dependence.
Humus recipe in ancient greek:
=> you receive a translation and work off of that
E.g. C, C++, Erlang, Haskell, Rust, and Go
Fuzzy search
Fuzzy search is a search technique that finds results that are similar to a search query, even if the query doesn’t match exactly