This commit is contained in:
Miloslav Ciz 2025-05-22 19:52:56 +02:00
parent ebb8cdf0ab
commit 35c0f438a4
11 changed files with 1992 additions and 1978 deletions

View file

@ -1,8 +1,8 @@
# Antivirus Paradox
# Antivirus Paradox (Perverse incentive)
{ I think this paradox must have had another established name even before antiviruses, but I wasn't able to find anything. If you know it, let me know. ~drummyfish }
{ Thanks to an anon who informed me about the correct name of this phenomenon <3 ~drummyfish }
Antivirus paradox is the paradox of someone who's job it is to eliminate certain undesirable phenomenon actually having an interest in keeping this phenomenon existing so as to keep his [job](work.md). A typical example is an [antivirus](antivirus.md) company having an interest in the existence of dangerous [viruses](virus.md) and [malware](malware.md) so as to keep their business running; in fact antivirus companies themselves secretly create and release viruses and malware.
Antivirus paradox (also *perverse incentive* or *cobra effect*) is the paradox of someone who's job it is to eliminate certain undesirable phenomenon actually having an interest in keeping this phenomenon existing so as to keep his [job](work.md). A typical example is an [antivirus](antivirus.md) company having an interest in the existence of dangerous [viruses](virus.md) and [malware](malware.md) so as to keep their business running; in fact antivirus companies themselves secretly create and release viruses and malware. The name cobra effect comes from a story in which government started to pay rewards for dead cobras in order to eliminate their numbers, which resulted in people actually breeding cobras to make more [money](money.md).
Cases of said behavior are common, e.g. the bind-torture-kill serial killer used to work as a seller of home security alarms who installed alarms for people who were afraid of being invaded by the bind-torture-killer, and then used his knowledge of the alarms to break into the houses -- a typical capitalist business. It is also a known phenomenon that many firefighters are passionate arsonists because society simply praises them for [fighting](fight_culture.md) fires (as opposed to rewarding them for the lack of fires).

View file

@ -5,7 +5,7 @@
WIP:
- If (you feel like) nobody [loves](love.md) you, then know that at least [drummyfish](drummyfish.md) does.
- Now if it's real serious, like [suicidal](suicide.md) thoughts serious, then rather seek help, there's no shame in it. You can refuse drugs or hospitalization, just talk to someone, that alone helps a lot. There's always some kind of anonymous hotline at least, it won't hurt to give it a try, no one has to know.
- Now if it's real serious, like [suicidal](suicide.md) thoughts serious, then rather seek help, there's no shame in it. You're not weak, even the strongest have their limits and you were probably unlucky enough to find yours. You can refuse drugs or hospitalization, just talk to someone, that alone helps a lot. There's always some kind of anonymous hotline at least, it won't hurt to give it a try, no one has to know.
- Going out to the nature always helps, or at least it can never hurt. Walking, nature, sun and fresh air help the body and healthy body leads to healthy mind, it's been known for thousands of years that pilgrimages heal the mind. Animals are best companions, go outside and observe them, play with them, talk to them. Do simple tasks, try to create something out of [wood](wood.md), collect [rocks](rock.md), draw something in the sand. If you're alone, singing is therapeutic as well, try it. Someone likes sports and getting tired physically to clear the mind. Definitely get off the Internet for a while, grab a physical book if you feel like reading something.
- Talking and sharing your trouble is almost guaranteed to help, even if you get no advice or resolution, simply getting it off your chest is literally such a huge relief. Talk to someone, to your friends or parents, it will be a little better. { If you have no one else to talk to, you can send me an email, I will listen. ~drummyfish }
- Get the feelings out (but not by hurting someone else, of course). If you feel sad, then cry, swear, run outside, tell someone how you feel, do whatever you have to to let it out. Some like to write down their thoughts, some like to listen to music, go through old photos, just don't suppress your feelings -- if not dealt with, they stay and become harder to get rid of.
@ -24,6 +24,7 @@ WIP:
- "If a problem has a solution, there's no need to worry, and if it doesn't have one, worrying won't help." Do not worry about that which is beyond your control, you can't blame yourself for what you didn't do intentionally and there's no use in trying to solve something that can't be solved, it is just wasted time and an added unnecessary suffering, it's like spending life by being worried about eventual death. If you caused harm to someone and it wasn't intentional, you can't blame yourself, an accident simply happen through you, a train driver cannot blame himself for someone having fallen under his train. If you harmed someone intentionally and feel guilty, then learn the lesson and move on, past is already gone, focus on the future, promise yourself to do better next time and don't torture yourself. Sometimes we're lucky and sometimes not, some are dealt worse cards than others, just try to make the best out of what you've got.
- If you feel all alone in the midst of all the evil of the world, perhaps it's because the system WANTS people like you to feel alone. There are so many humans in the world that it's highly improbably you are the only one, you just haven't met the right people, many are shy, scared and hiding. Consider how deep various Internet rabbitholes go, you can follow them infinitely, keep finding communities around weirdest things, thousands upon thousands and it never ends, what you see is just the tip of the iceberg. Your soulmate is out there somewhere.
- **You will change with age.** You think you won't but you will, the trouble you have now will either disappear or you will literally stop caring -- they will be replaced by new trouble, but whatever you think is the worst problem in the world right now will most likely turn out to be something you hardly remember 10 years later, your brain and perception of the world physically changes as you age, as does your environment. There was probably something like this 10 years ago, you now only laugh about it. Even if you don't solve the problem and it gets worse, you will simply not care about it that much -- to a young guy losing a leg or becoming blind is a tragedy, but an old man takes it much better, he rather cares about his family, a child only cares about latest video games but an adult hardly gives a shit. May you're poor but will get rich, maybe you'll get sick, find a new religion, have children, move to another country, everything will change. Just hold on and observe what the fate has for you.
- **If you're depressed about the [future](future.md), simply focus on the present**, live day to day and go step by step, things will probably turn out much different than what you imagined anyway and many problems often just solve themselves (even if new, unforeseen ones emerge as well). In retrospect you will probably find you didn't even have any power over what would eventually happen, so don't worry too much. Having plans and being ready certainly helps, but don't obsess over worrying too much if you can. If you don't know what to do, do what you know and then you'll see.
- ...
TO BE CONTINUED

View file

@ -8,7 +8,7 @@ Except for [drummyfish](drummyfish.md) only fascists live in the country, essent
**There is literally NOTHING in this shitty country**, it doesn't make any sense for anyone to go there. No, girls won't sleep with you unless you pay. Sea? The country is as far away from the sea as it gets on the continent. Mountains? Nope, there's maybe one or two medium sized hills. Nice nature, like some cool waterfalls or something? Nope, plastic shit everywhere, roads, light pollution, only boring animals and normal generic trees. All bodies of water are non-transparent dark green/brown swamp with clouds of mosquitoes, you won't find any stationary clear water, probably due to shitty geology or something (for example in Croatia even stationary fresh water is clear). Nice weather? Nope, most of the time there is autumn weather, too cold to go swimming, too hot for snow to fall, it's always either windy or raining and if you have allergies don't even try to go out. There are great many mosquitoes and annoying bugs though. Nice architecture? No, just depressive old soviet buildings or ugly capitalist shit. Nice cities? No lol, one of the most famous cities, Ostrava, is just famous for drowning in smog, people of the city made that part of their identity. Prague? That's the most shitty garbage city on [Earth](earth.md), there is literally nothing, just one old bridge, there is NOTHING else in there, and the bridge looks like shit anyway. Furthermore worst human scum lives in Prague, it's like little [USA](usa.md), basically a city of youtubers, it has the greatest concentration of cretins on square meter, it makes you wanna kill yourself just to hear someone talk or see someone's face there -- in fact in Prague there is a bridge specifically dedicated to suicides because suicide is in such a high demand there.
Czech [language](human_language.md) is unironically **the worst language** that there ever was or ever will be. Firstly it sounds horrible, secondly it's the hardest language on [Earth](earth.md), it has seven cases and declinations/inflections and things that make every word have like 20 distinct forms (e.g. "to teach": ucit, ucil, ucila, ucilo, ucili jsme, ucili jste, ucili, ucim, ucis, uci, ucime, ucite, budu ucit, budes ucit, ucil bych, ucila bys, ucili bychom, ... ; "dog": pes, psa, psu, psovi, psi, pse, psy, psum, psech, pejsek, pejsku, pejskovi, pejsky, ... ; "cat": kocka, kocce, kocku, kockou, kocky, kockam, kocicka, kocicce, kocicku, kocickami, ...), NOT EVEN such essential things as forming plural or calling someone are simple at all (e.g. word/plural/vocative: pes/psi/pse, kocka/kocky/kocko, dum/domy/dome, stroj/stroje/stroji, ... do you see any pattern? probably not) PLUS, according to Guinness World Record Book, it also contains the most difficult sound to pronounce (that *r* with arrow above it, great many natives actually can't say it, it's called *rackovani*), there are so many irregularities that children spend whole years at school just hardcore memorizing when to write *y* versus *i* (which are pronounced completely the same, you just have to know which one to write because why not), also for example commas and capitalization of words have strict, extremely difficult rules that again have to be memorized. AND all this effort is for nothing, it doesn't make a slightest sense to learn the language because no one excepts a few idiots in middle of Europe speak it (and not even they speak it well), you will literally hear it nowhere else. So that's another thing.
Czech [language](human_language.md) is unironically **the worst language** that there ever was or ever will be. Firstly it sounds horrible, secondly it's the hardest language on [Earth](earth.md), it has seven cases and declinations/inflections and things that make every word have like 20 distinct forms (e.g. "to teach": ucit, ucil, ucila, ucilo, ucili jsme, ucili jste, ucili, ucim, ucis, uci, ucime, ucite, budu ucit, budes ucit, ucil bych, ucila bys, ucili bychom, ... ; "dog": pes, psa, psu, psovi, psi, pse, psy, psum, psech, pejsek, pejsku, pejskovi, pejsky, ... ; "cat": kocka, kocce, kocku, kockou, kocky, kockam, kocicka, kocicce, kocicku, kocickami, ...), NOT EVEN such essential things as forming plural or calling someone are simple at all (e.g. word/plural/vocative: pes/psi/pse, kocka/kocky/kocko, dum/domy/dome, stroj/stroje/stroji, ... do you see any pattern? probably not) PLUS, according to Guinness World Record Book, it also contains the most difficult sound to pronounce (that *r* with arrow above it, great many natives actually can't say it, it's called *rackovani*), there are so many irregularities that children spend whole years at school just hardcore memorizing when to write *y* versus *i* (which are pronounced completely the same, you just have to know which one to write because why not, although honestly it's the same kind of bullshit as memorizing all [US](us.md) presidents), also for example commas and capitalization of words have strict, extremely difficult rules that again have to be memorized. AND all this effort is for nothing, it doesn't make a slightest sense to learn the language because no one excepts a few idiots in middle of Europe speak it (and not even they speak it well), you will literally hear it nowhere else. So that's another thing.
IMPORTANT NOTE: Czech language knows the word kurva, which has the same meaning as kurwa in Polish, but is written with *v* instead of *w*.

View file

@ -55,7 +55,7 @@ What follows is an info about Drummyfish that might be called """sensitive""":
- **hair color**: dark
- **handedness**: right (both hand and foot)
- **blood type**: AB
- **education and shit**: elementary school T. G. Masaryka in Maratice (1st and 2nd grade), elementary school ZS Babice (until 2006), high school SPS Zlin: technicke lyceum (graduation in 2010), bachelor's degree from Faculty of Information Technology at Brno University of Technology ([computer science](computer_science.md), graduation in 2014), master's degree from the same ([computer graphics](graphics.md) and multimedia, graduation in 2017), driver's license (forgot to drive already)
- **education and shit**: elementary school T. G. Masaryka in Maratice (1st and 2nd grade), elementary school ZS Babice (until 2006), high school SPS Zlin: technicke lyceum (graduation in 2010), bachelor's degree from Faculty of Information Technology at Brno University of Technology ([computer science](computer_science.md), graduation in 2014), master's degree from the same ([computer graphics](graphics.md) and multimedia, graduation in 2017), driver's license (forgot how to drive already)
- **Mayer-Briggs**: [INTJ](intj.md)
- **orientation/fetishes**: basically straight but perverted and not afraid of anything, will jerk off to anyone and anything (including necro, zoo, gore, incest, scat, anorexic, fat, [gay](gay.md), [tranny](transsexual.md), lesbian, ...), however sexual drive is quite low and masturbation is just a routine, curiously he LACKS fetishes that are "too common and mainstream" such as [BDSM](bdsm.md), nipple twisting, feet, [furry](furry.md) shit, hentai, 3D, [deepfakes](deepfake.md) and so on (it looks like forbidden fruit is what turns him on)
- **preferred girl type**: Very pale, longer darker hair (ginger would pass too), [anorexic](anorexia.md) to normal weight, shorter to normal height, flat to normal sized tits, small ass, NO muscle, shy, mustn't have any [tattoos](tattoo.md) or piercing.

2
faq.md
View file

@ -28,7 +28,7 @@ I dunno, I don't do anything like that now, remember this isn't a blog, tho you
### How does LRS differ from [suckless](suckless.md), [KISS](kiss.md), [free software](free_software.md) and similar types of software?
Sometimes these sets may greatly overlap and LRS is at times just a slightly different angle of looking at the same things, but in short LRS cherry-picks the best of other things and is much greater in scope (it focuses on the big picture of whole society). I have invented LRS as my own take on suckless software and then modified it a bit and expanded its scope to encompass not just technology but the whole society -- as I cannot speak on behalf of the whole suckless community (and sometimes disagree with them a lot), I have created my own "fork" and simply set my own definitions without worrying about misinterpreting, misquoting or contradicting someone else. LRS advocates very similar technology to that advocated by suckless, but it furthermore has its specific ideas and areas of focus. The main point is that **LRS is derived from an unconditional love of all life** rather than some shallow idea such as "[productivity](productivity_cult.md)". In practice this leads to such things as a high stress put on [public domain](public_domain.md) and legal safety, [altruism](altruism.md), selflessness, anti-[capitalism](capitalism.md), accepting [games](game.md) as desirable type of software, **NOT subscribing to the [productivity cult](productivity_cult.md), rejecting [security](security.md), [privacy](privacy.md), [cryptocurrencies](crypto.md) etc.** While suckless is apolitical and its scope is mostly limited to software and its use for "getting job done", LRS speaks not just about technology but about the whole society -- there are two main parts of LRS: [less retarded software](lrs.md) and [less retarded society](less_retarded_society.md).
These sets will typically largely overlap and LRS is at times just a slightly different approach or angle of viewing the world, but in short LRS is eclectic, we cherry-pick the best of what's already out there, then add something slightly original on top to create a something greater in scope than let's say suckless (we ultimately focus on the big picture of whole society, not just the tools and "getting the job done"). I have invented LRS as my own take on suckless software and then modified it a bit and expanded its scope to encompass not just technology but the whole society -- as I cannot speak on behalf of the whole suckless community (and sometimes disagree with them a lot), I have created my own "fork" and simply set my own definitions without worrying about misinterpreting, misquoting or contradicting someone else. LRS advocates very similar technology to that advocated by suckless, but it furthermore has its specific ideas and areas of focus. The main point is that **LRS is derived from an unconditional love of all life** rather than some shallow idea such as "[productivity](productivity_cult.md)". In practice this leads to such things as a high stress put on [public domain](public_domain.md) and legal safety, [altruism](altruism.md), selflessness, anti-[capitalism](capitalism.md), accepting [games](game.md) as desirable type of software, **NOT subscribing to the [productivity cult](productivity_cult.md), rejecting [security](security.md), [privacy](privacy.md), [cryptocurrencies](crypto.md) etc.** While suckless is apolitical and its scope is mostly limited to software and its use for "getting job done", LRS speaks not just about technology but about the whole society -- there are two main parts of LRS: [less retarded software](lrs.md) and [less retarded society](less_retarded_society.md).
One way to see LRS is as a philosophy that takes only the [good](good.md) out of existing philosophies/movements/ideologies/etc. and adds them to a single unique [idealist](idealism.md) mix, without including [cancer](cancer.md), [bullshit](bullshit.md), errors, propaganda and other negative phenomena plaguing basically all existing philosophies/movements/ideologies/etc.

View file

@ -1,6 +1,6 @@
# Markov Chain
Markov chain is a relatively simple [stochastic](stochastic.md) (working with [probability](probability.md)) [mathematical](math.md) [model](model.md) for predicting or generating sequences of symbols. It can be used to describe some processes happening in the [real world](irl.md) such as behavior of some animals, Brownian motion or structure of a [language](human_language.md). In the world of [programming](programming.md) Markov chains are pretty often used for generation of texts that look like some template text whose structure is learned by the Markov chain (Markov chains are one possible model used in [machine learning](machine_learning.md)). Chatbots are just one example.
Markov chain is a relatively simple [stochastic](stochastic.md) (working with [probability](probability.md)) [mathematical](math.md) [model](model.md) that captures a "statistical structure" of a sequence of symbols (words, letters, [numbers](number.md), [musical](music.md) notes, ...) and is typically used for predicting or generating such sequences. It can very well describe certain processes that occur in the [real world](irl.md) such as behavior of some animals, Brownian motion or structure of [human language](human_language.md). In [programming](programming.md) Markov chains are pretty often used for generating "random" text that resembles given sample text -- Markov chain learns the structure of the sample text by computing probabilities of words following other words and then generates a new text so that these probabilities are preserved (of course, the new text will be a nonsensical gibberish from linguistic point of view, but it will resemble the template text statistically and "visually"). Chatbots and [procedural generation](procgen.md) are just some examples of where we might encounter Markov chains. This is however not where the use cases end -- an advanced use of Markov chain may be for example identification of the text author by the writing style, since it can be assumed that different authors prefer to use different words, phrases and idioms which will show in the generated Markov chain, and comparing these to the chain generated from the anonymous writing may give away the true author.
There are different types of Markov chains. Here we will be focusing on discrete time Markov chains with finite state space as these are the ones practically always used in programming. They are also the simplest ones.

File diff suppressed because it is too large Load diff

24
tree.md
View file

@ -2,11 +2,13 @@
WIP
Tree is an [abstract](abstraction.md) [mathematical](math.md) structure, adopted and frequently used as a [data type](data_type.md) and [data structure](data_structure.md) in [programming](programming.md), which in simplified terms consists of nodes that form a loopless [graph](graph.md) resembling an upside-down tree when drawn on paper. Slightly more presicely tree can be defined as a [set](set.md) of nodes of which each has assigned exactly one of the other nodes as its parent, except for the *root* node that has no parent, in such a way that there are no cycles (i.e. between any two nodes there always exists exactly one path). The definitions may vary slightly, for example in mathematics it's defined as an undirected graph whereas in [computer science](compsci.md) it may be seen as directed (because parents "point" to their children), but generally always the same idea underlies the definition. In the context of programming it's important to note that tree is a **hierarchical** structure, i.e. consisting of "levels": the first level is the root node, the second its children, the third their children etc. A close to [real life](irl.md) example of a tree might be the taxonomy tree used in biology to classify living organisms by dividing them into big groups and subsequent subgroups such as kingdom, family and species. As for their significance, trees are among the most essential structures in both programming and mathematics, they belong more or less to intermediate programming. The importance of trees can hardly be overstated, they see frequent use for example as an [indexing](index.md) structure that greatly accelerates searching [databases](database.md). A set of several disconnected trees is called a [forest](forest.md).
Tree is an [abstract](abstraction.md) [mathematical](math.md) structure, adopted and frequently used as a [data type](data_type.md) and [data structure](data_structure.md) in [programming](programming.md), which in simplified terms consists of nodes that form a loopless [graph](graph.md) resembling an upside-down tree when drawn on paper. Slightly more presicely tree can be defined as a [set](set.md) of nodes of which each has assigned exactly one of the other nodes as its parent, except for the *root* node that has no parent, in such a way that there are no cycles (i.e. between any two nodes there always exists exactly one path). The definitions may vary slightly, for example in mathematics it's defined as an undirected graph whereas in [computer science](compsci.md) it may be seen as directed (because parents "point" to their children), but generally always the same idea underlies the definition: that of a hierarchical structure of nodes branching out from a single origin like a tree. A set of several disconnected trees is called a [forest](forest.md); additionally there also exist generalized notions and structures based on trees such as [B](b_tree.md) and [B+](b_plus_tree.md) trees whose leaf nodes may also be connected into a [linked list](linked_list.md), [directed acyclic graphs](dag.md) where nodes may have more than one parent etc.
Tree is also a kind of very big plant that has trunk and branches and this kind of stuff. It is no coincidence the programming structure is also called a tree -- it's so because the structure is similar to the physical, real life tree and we conveniently borrow more terms with real life analogies (root, branches, leaves, [pruning](pruning.md), forest, ...).
It's also possible to give a [beautiful](beauty.md), [recursive](recursion.md) definition of a tree: tree is a node *N0* that has a number (even [zero](zero.md)) of children, each of which is a tree of which none share any node and none contains *N0*. In fact recursion is something inherently associated with trees: [algorithms](algorithm.md) for traversing trees, for instance, are typically recursive in nature.
It's also possible to give a [beautiful](beauty.md), **[recursive](recursion.md) definition of a tree**: tree is a node *N0* that has a number (even [zero](zero.md)) of children, each of which is a tree of which none share any node and none contains *N0*. I.e. tree is a node whose children are themselves also trees, just like a real life tree is a kind of composed of smaller and smaller versions of the big tree (which we call branches; see also [fractal](fractal.md)). In fact recursion is something inherently associated with trees: for example [algorithms](algorithm.md) for traversing trees are typically recursive in nature.
Insofar as programming goes, the key characteristic of trees is their **hierarchical** structure, i.e. the fact they consist of "levels": the first level is the root node, the second its children, the third their children etc. A close to [real life](irl.md) example of a tree might be the taxonomy tree used in biology to classify living organisms by dividing them into big groups and subsequent subgroups such as kingdom, family and species. As for their significance, trees are among the most essential structures in both programming and mathematics, they belong more or less to intermediate programming. The importance of trees can hardly be overstated, they see frequent use for example as an [indexing](index.md) structure that greatly accelerates searching bigger amounts of data; this is well exemplified for instance by octrees (N-ary tree with *N = 8*) in [physics engines](physics_engine.md) subdividing a big cubic portion of the 3D world into 8 smaller cubes, each of which is subsequently split in similar way and so on up to the level of small spatial cells -- this representation helps quickly decide which objects are in the proximity of given point and so resolve [collisions](collision.md) quickly and efficiently. The same idea is used in [3D graphics](3d_rendering.md) to decide what's in the camera's view (it's a form of collision detection too), and will be especially fitting for [voxel](voxel.md)-based games where each voxel is the final leaf node of the octree.
```
666
@ -21,17 +23,29 @@ It's also possible to give a [beautiful](beauty.md), [recursive](recursion.md) d
6 9 7 1
```
*Example of a binary tree of height 4. It's also a [heap](heap.md) because each parent is greater in value than any of its children. It might be [serialized](serialization.md) as: (((6)69(9))96())666((66)99((7)71(1))).*
*Example of a binary tree of height 4. It's also a [heap](heap.md) as each parent is greater in value than any of its children. It might be [serialized](serialization.md) as: (((6)69(9))96())666((66)99((7)71(1))).*
Terminology: the first, topmost node without any parent is called **root node**. Nodes that have no children are called **leaf nodes**; nodes being neither a root nor a leaf are usually called **internal nodes**. We may also encounter terms such as **subtrees** and **branches**. Relationships between nodes are described by the same nouns used for family relationships, i.e.: **parent node**, **child node**, **sibling node**, **ancestor node**, **descendant node** etc., although some relationships are NOT in common use, e.g. "grandfather node", "cousin node" or "uncle node" (:D). Then we name properties such as the **node depth** (length of the path from the root to the node), **tree height** (maximum of all leaves' depths), **tree size** (total node count), **tree breadth** (leaf count) etc.
**Terminology**: the first, topmost node without any parent is called **root node**. Nodes that have no children are called **leaf nodes**; nodes being neither a root nor a leaf are usually called **internal nodes**. We may also encounter terms such as **subtrees** and **branches**. Relationships between nodes are described by the same nouns used for family relationships, i.e.: **parent node**, **child node**, **sibling node**, **ancestor node**, **descendant node** etc., although some relationships are NOT in common use, e.g. "grandfather node", "cousin node" or "uncle node" (:D). Then we name properties such as the **node depth** (length of the path from the root to the node), **tree height** (maximum of all leaves' depths), **tree size** (total node count), **tree breadth** (leaf count) etc.
We classify trees by various properties they may have, for example their height, "density", purpose ("decision tree", ...), constraints they satisfy ("heap", ...) or attributes such as being "balanced". Arguably the most important kinds of trees to introduce are **N-ary trees** in which any node is allowed to have no more than *N* children. N-ary trees, and especially [binary](binary.md) trees (*N = 2*), are frequently encountered in programming because (for [simplicity](simplicity.md) and performance) nodes in computer memory have often preallocated a fixed number of [pointers](pointer.md) to their child nodes and this imposes a limit on the maximum number of children. Knowing that a tree is N-ary has additional advantages too, for instance it's possible to easily compute the maximum size a tree of given height will require in memory and so on.
We classify trees by various properties they may have, for example their height, "density", purpose ("decision tree", "search tree" ...), constraints they satisfy ("heap", ...), what kind of value the nodes store and where (in all nodes, just leaves, ...) or attributes such as being "balanced". Arguably the most important kinds of trees to introduce are **N-ary trees** in which any node is allowed to have no more than *N* children. N-ary trees, and especially [binary](binary.md) trees (*N = 2*), are frequently encountered in programming because (for [simplicity](simplicity.md) and performance) nodes in computer memory have often preallocated a fixed number of [pointers](pointer.md) to their child nodes and this imposes a limit on the maximum number of children. Knowing that a tree is N-ary has additional advantages too, for instance it's possible to easily compute the maximum size a tree of given height will require in memory and so on. In case of *N = 1* the tree degenerates into a [linked list](linked_list.md).
TODO: more more more
## Programming
Let's begin this section with a little practical note: trees are a very popular subject of programming classes and they've become a kind of exercise playground for students who are made by their teachers to write all the common algorithms like adding nodes, deleting them, searching, traversing the tree in various ways and so on. It's really a quite convenient structure, neither too simple nor overly complicated, and one at which many concepts can be demonstrated. However the catch is that the presented and required "textbook" implementation of trees in these classes is almost always very impractical and quite bad, it's an educational way of implementing trees that's never used in practice. It normally goes like this: each tree node is a data type (or [object](oop.md) or something) with a value (whatever's stored in the node, for example a number) and a list/array of pointers to children nodes, and the process of adding/removing nodes involves dynamic memory allocation per every node, i.e. when adding a node we allocate memory of the exact size of the node (with `malloc` etc.), then we store the new node there and connect it to the parent. During node removal we disconnect the node and free the allocated memory. In practice, and then also more so in [LRS](lrs.md), this is a cookbook recipe that can be followed and understood by average "[coders](coder.md)", but it's almost always a very suboptimal solution -- either [overcomplicated](bloat.md) and/or inefficient and slow (memory allocation per every operation is a performance killer, may also result in more [cache](cache.md) unfriendly memory layout) and/or buggy (memory leaks, segfaults, ...) etc. It can practically always be done much better, but the exact way depends on the specific case at hand.
NOTE: from storage point of view it would actually be better if children kept pointers to their parents than the other way around, as nodes (except for the root of course) always have exactly one parent, so this would avoid all the mess with list/arrays of pointers. But the process of tree traversal goes from parents to children, so in code the pointers usually point in this direction. Still, a file format for storing trees may still consider going with the former option.
For example the memory allocation issue -- if we really DO need dynamic allocation, which is almost never the case -- can be improved by allocating by bigger blocks; let's say we'll always allocate a space for 128 nodes and then, once we run out of this space, we may allocated additional 128 node places and so on. This will result in less frequent malloc/free calls, i.e. faster code, and will also guarantee nodes will be closer together in memory, which is better for cache (if we additionally use `realloc`, we'll be keeping ALL the nodes in a continuous array in memory, which is ideal). However even this will be sometimes too complicated and we can do away just with static allocation, or maybe in some cases our tree is a static, precomputed structure (happens a lot with game levels and so on) that won't change at runtime and so we don't have to bother with allocation and adding nodes at all. Sometimes we can even get away with literally representing the whole tree as a single serialized [ASCII](ascii.md) string in memory without having to create a whole module with special Node and Tree types and object and methods and whatnot, there are scenarios where [keeping it simple](kiss.md) [just works](just_werks.md) the best. Sometimes indices may be better than pointers etc. All of this is to say simply that we must consider the specific scenario we have at hand and choose the best implementation based on this.
TODO
## See Also
- [directed acyclic graph](dag.md)
- [graph](graph.md)
- [fractal](fractal.md)
- [heap](heap.md)
- [list](list.md)
- [hash table](hash_table.md)

2
usa.md

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2,10 +2,10 @@
This is an autogenerated article holding stats about this wiki.
- number of articles: 641
- number of commits: 1022
- total size of all texts in bytes: 5530954
- total number of lines of article texts: 39859
- number of articles: 642
- number of commits: 1023
- total size of all texts in bytes: 5544258
- total number of lines of article texts: 39927
- number of script lines: 324
- occurrences of the word "person": 10
- occurrences of the word "nigger": 150
@ -35,60 +35,69 @@ longest articles:
top 50 5+ letter words:
- which (2976)
- there (2351)
- which (2982)
- there (2356)
- people (2225)
- example (1922)
- other (1700)
- about (1522)
- number (1464)
- example (1928)
- other (1706)
- about (1524)
- number (1468)
- software (1321)
- because (1251)
- their (1169)
- something (1147)
- would (1133)
- being (1105)
- program (1082)
- language (1030)
- called (998)
- things (958)
- without (925)
- because (1256)
- their (1174)
- something (1153)
- would (1137)
- being (1115)
- program (1083)
- language (1031)
- called (1005)
- things (956)
- without (926)
- simple (899)
- function (881)
- numbers (879)
- computer (870)
- different (842)
- these (811)
- world (808)
- however (804)
- programming (803)
- should (783)
- numbers (880)
- computer (874)
- different (843)
- these (810)
- programming (810)
- world (809)
- however (805)
- should (782)
- system (775)
- still (773)
- doesn (750)
- games (737)
- possible (722)
- drummyfish (722)
- always (708)
- point (706)
- while (696)
- still (774)
- doesn (751)
- games (739)
- drummyfish (729)
- possible (724)
- always (715)
- point (707)
- probably (699)
- while (697)
- society (695)
- probably (695)
- simply (689)
- simply (688)
- https (677)
- using (664)
- someone (643)
- course (642)
- actually (634)
- similar (629)
- first (619)
- value (612)
- though (597)
- really (585)
- someone (648)
- course (644)
- actually (635)
- similar (630)
- first (621)
- value (614)
- though (596)
- really (587)
latest changes:
```
Date: Wed May 21 21:59:16 2025 +0200
drummyfish.md
main.md
privacy.md
random_page.md
security.md
tree.md
wiki_pages.md
wiki_stats.md
Date: Tue May 20 21:52:04 2025 +0200
4chan.md
acronym.md
@ -115,25 +124,12 @@ Date: Tue May 20 21:52:04 2025 +0200
wiki_stats.md
wikipedia.md
woman.md
Date: Thu May 15 21:57:58 2025 +0200
90s.md
anorexia.md
capitalist_software.md
cheating.md
cope.md
exercises.md
fun.md
furry.md
javascript.md
main.md
nigger.md
random_page.md
```
most wanted pages:
- [irl](irl.md) (16)
- [data_type](data_type.md) (16)
- [irl](irl.md) (15)
- [retard](retard.md) (14)
- [meme](meme.md) (13)
- [embedded](embedded.md) (13)
@ -143,10 +139,10 @@ most wanted pages:
- [complex_number](complex_number.md) (11)
- [buddhism](buddhism.md) (11)
- [array](array.md) (11)
- [tree](tree.md) (10)
- [jew](jew.md) (10)
- [drm](drm.md) (10)
- [sdl](sdl.md) (9)
- [pointer](pointer.md) (9)
- [irc](irc.md) (9)
- [good](good.md) (9)
- [brute_force](brute_force.md) (9)
@ -158,33 +154,33 @@ most popular and lonely pages:
- [lrs](lrs.md) (350)
- [capitalism](capitalism.md) (325)
- [bloat](bloat.md) (250)
- [c](c.md) (248)
- [c](c.md) (249)
- [free_software](free_software.md) (210)
- [game](game.md) (165)
- [suckless](suckless.md) (152)
- [proprietary](proprietary.md) (141)
- [proprietary](proprietary.md) (142)
- [modern](modern.md) (133)
- [minimalism](minimalism.md) (130)
- [computer](computer.md) (130)
- [censorship](censorship.md) (127)
- [kiss](kiss.md) (124)
- [fun](fun.md) (122)
- [math](math.md) (120)
- [math](math.md) (121)
- [programming](programming.md) (119)
- [shit](shit.md) (118)
- [programming](programming.md) (118)
- [woman](woman.md) (114)
- [woman](woman.md) (115)
- [gnu](gnu.md) (108)
- [art](art.md) (108)
- [history](history.md) (107)
- [linux](linux.md) (106)
- [bullshit](bullshit.md) (105)
- [corporation](corporation.md) (104)
- [bullshit](bullshit.md) (106)
- [corporation](corporation.md) (105)
- [fight_culture](fight_culture.md) (101)
- [hacking](hacking.md) (97)
- [work](work.md) (95)
- [work](work.md) (96)
- [internet](internet.md) (95)
- [less_retarded_society](less_retarded_society.md) (94)
- [programming_language](programming_language.md) (92)
- [programming_language](programming_language.md) (93)
- ...
- [game_design](game_design.md) (5)
- [friend_detox](friend_detox.md) (5)