What are complexity classes?
You may have heard about NP-hard or NP-complete algorithms, but what do they mean?
Here is a good article to start
https://brilliant.org/wiki/complexity-classes/
A complexity class contains a set of problems that take a similar range of space and time to solve, for example "all problems solvable in polynomial time with respect to input size," "all problems solvable with exponential space with respect to input size," and so on.
Now what are P and NP classes?
Algorithms like Merge-sort, Quick-sort, Binary search, ... that are solved in polynomial time (like n^k) are in the P class
Problems like TSP , Set covering problem , ... that are solved in nondeterministic polynomial-time are in the NP class
You may have heard about NP-hard or NP-complete algorithms, but what do they mean?
Here is a good article to start
https://brilliant.org/wiki/complexity-classes/
A complexity class contains a set of problems that take a similar range of space and time to solve, for example "all problems solvable in polynomial time with respect to input size," "all problems solvable with exponential space with respect to input size," and so on.
Now what are P and NP classes?
Algorithms like Merge-sort, Quick-sort, Binary search, ... that are solved in polynomial time (like n^k) are in the P class
Problems like TSP , Set covering problem , ... that are solved in nondeterministic polynomial-time are in the NP class
❤2
Funny thing is, We really don't know if P is equal to NP or not! That's why you'll usually see this picture containing two different diagrams.
And if it turns out that P=NP, many of our security algorithms that protect our computers, banks, and more, will be obsolete.
Needless to say that is very unlikely, most computer scientists believe that they are not equal.
#time_complexity #np_complete
And if it turns out that P=NP, many of our security algorithms that protect our computers, banks, and more, will be obsolete.
Needless to say that is very unlikely, most computer scientists believe that they are not equal.
#time_complexity #np_complete
🔥1
Is mocking really useful? (Betteridge says hello)
https://blog.boot.dev/clean-code/writing-good-unit-tests-dont-mock-database-connections
What is mocking? I like to call it the process of simulating a dependency in unit-tests in order to test the logic dependent on it.
It sounds good at first, but should you be mocking your dependencies? Or is there a better way? The article above shares a good view on these questions
https://blog.boot.dev/clean-code/writing-good-unit-tests-dont-mock-database-connections
What is mocking? I like to call it the process of simulating a dependency in unit-tests in order to test the logic dependent on it.
It sounds good at first, but should you be mocking your dependencies? Or is there a better way? The article above shares a good view on these questions
What are #cache memories? and how do they improve performance?
https://ecomputertips.com/what-is-cache-memory/
And now that you know about that, what are cache lines?
https://ecomputertips.com/cache-line/
https://ecomputertips.com/what-is-cache-memory/
And now that you know about that, what are cache lines?
https://ecomputertips.com/cache-line/
Accio
Photo
And at the end, how did rust improved its performance by improving cache access for CPU?
https://codspeed.io/blog/rust-1-78-performance-impact-of-the-128-bit-memory-alignment-fix
Basically they improved memory alignments in a way that the CPU has to read fewer cache-lines in some scenarios.
https://codspeed.io/blog/rust-1-78-performance-impact-of-the-128-bit-memory-alignment-fix
Basically they improved memory alignments in a way that the CPU has to read fewer cache-lines in some scenarios.
If you've been doing typescript for a while this could be interesting:
https://effect.website/
Effect introduces a new way to write typescript applications. it's mostly famous for its error handling method, basically there isn't any throw/try/catch. Errors are considered values and this usually results in safer programs
https://effect.website/
Effect introduces a new way to write typescript applications. it's mostly famous for its error handling method, basically there isn't any throw/try/catch. Errors are considered values and this usually results in safer programs
effect.website
Effect – The best way to build robust apps in TypeScript
Effect is a powerful TypeScript library designed to help developers easily create complex, synchronous, and asynchronous programs.
Accio
Footage from: Conway's game of life
Celluar automaton
A very simple yet interesting autometa theory. It consists of a grid which has a finate number of states (or squares) that can be on or off, each having ,for example, 8 neighbors. It also has a starting condition (The only input given to the machine) and then it simply iterates over and updates the grid based on its given conditions.
A basic example of it is the Conway's Game of Life which simulates, life!
In Conway's Game of Life, cells are either alive (black) or dead (white).
At each step:
- Any alive cell with fewer than two live neighbors dies, as if by underpopulation
- Any alive cell with two or three neighbors lives on
-Any alive cell with more than 3 live neighbors dies. As if by overpopulation
-Any dead cell with exactly 3 live neighbors becomes alive as if by reproduction
This may seem very basic, but it applies to other areas such as chemistry, biology, physics and even in music!
More on cellular automaton:
https://en.m.wikipedia.org/wiki/Cellular_automaton
#FSA #computation
A very simple yet interesting autometa theory. It consists of a grid which has a finate number of states (or squares) that can be on or off, each having ,for example, 8 neighbors. It also has a starting condition (The only input given to the machine) and then it simply iterates over and updates the grid based on its given conditions.
A basic example of it is the Conway's Game of Life which simulates, life!
In Conway's Game of Life, cells are either alive (black) or dead (white).
At each step:
- Any alive cell with fewer than two live neighbors dies, as if by underpopulation
- Any alive cell with two or three neighbors lives on
-Any alive cell with more than 3 live neighbors dies. As if by overpopulation
-Any dead cell with exactly 3 live neighbors becomes alive as if by reproduction
This may seem very basic, but it applies to other areas such as chemistry, biology, physics and even in music!
More on cellular automaton:
https://en.m.wikipedia.org/wiki/Cellular_automaton
#FSA #computation
Accio
GIF
Visualization of a lattice gas automaton. The shades of grey of the individual pixels are proportional to the gas particle density (between 0 and 4) at that pixel. The gas is surrounded by a shell of yellow cells that act as reflectors to create a closed space.
From CA wikipedia page
From CA wikipedia page
Accio
Footage from: Conway's game of life
If you are wondering where does such automata stands in terms of computational power, it is turing-complete
❤1
Accio
Photo
Build your own text editor with C in terminal
https://viewsourcecode.org/snaptoken/kilo
Kilo is a text editor written in C with <1000 lines of code (Thats why it's called a Kilo)
The link above is a step by step walk through of building it all over by yourself! You may do it for fun or even to refresh your basic C skills
I'm doing this tutorial myself, it's so easy to follow. If you want to know the story behind its creation see the authors blog post about it
#c #tui #kilo #editor
https://viewsourcecode.org/snaptoken/kilo
Kilo is a text editor written in C with <1000 lines of code (Thats why it's called a Kilo)
The link above is a step by step walk through of building it all over by yourself! You may do it for fun or even to refresh your basic C skills
I'm doing this tutorial myself, it's so easy to follow. If you want to know the story behind its creation see the authors blog post about it
#c #tui #kilo #editor
Just got rick rolled by svelte tutorial
Svelte is a lightweight and fast javascript framework used in front-end. similar to react but apparently easier to learn.
https://svelte.dev/
#javascript #js #svelte #frontend
Svelte is a lightweight and fast javascript framework used in front-end. similar to react but apparently easier to learn.
https://svelte.dev/
#javascript #js #svelte #frontend
svelte.dev
Web development for the rest of us
Zoxide, a better cd command
https://github.com/ajeetdsouza/zoxide
I've been using zoxide for some time now, it's simple yet effective
for example if you use
instead of
Zoxide will remember the path and next time you could use
to end up in the same directory
#shell
https://github.com/ajeetdsouza/zoxide
I've been using zoxide for some time now, it's simple yet effective
for example if you use
z path/to/mydir
instead of
cd path/to/mydir
Zoxide will remember the path and next time you could use
z mydir
to end up in the same directory
#shell
GitHub
GitHub - ajeetdsouza/zoxide: A smarter cd command. Supports all major shells.
A smarter cd command. Supports all major shells. Contribute to ajeetdsouza/zoxide development by creating an account on GitHub.
👍4