← Home ← Back to /g/

Thread 106914762

45 posts 6 images /g/
Anonymous No.106914762 [Report] >>106914792 >>106914795 >>106914799 >>106914896 >>106914913 >>106915219 >>106915345 >>106915371 >>106915910 >>106915973 >>106923568 >>106923890
Do people actually know how data structures work or are they all pretending?
Every example of a binary tree is like image related
Anonymous No.106914792 [Report] >>106914863
>>106914762 (OP)
>do people know how datastructures work
What are you specifically asking? Data is conceptually or physically structured in a way that is helpful for some algorithm to do something. The datastructure itself in and of itself is almost meaningless.
Anonymous No.106914795 [Report]
>>106914762 (OP)
I don't have a clue and I pretend to know about computers.
Anonymous No.106914799 [Report] >>106914814
>>106914762 (OP)
Nobody fucking knows shit trust me I know because I code in machine code
Anonymous No.106914814 [Report] >>106915097
>>106914799
>Nobody fucking knows shit
>trust me I know
you lied to me...
Anonymous No.106914863 [Report] >>106914887 >>106914888 >>106916212
>>106914792
The abstraction is for storing, sorting and finding data
What about that tree is good? You can't find anything in it
Anonymous No.106914887 [Report] >>106915027
>>106914863
general binary trees are mostly useful in academic contexts to get students comfortable with abstract data types. binary search trees can be useful for, well... search
if you really want a practical application for general binary trees, they can be used for huffman encoding or for abstract syntax trees
Anonymous No.106914888 [Report] >>106915027
>>106914863
A binary tree is just a set of characteristics. The idea of links between data can be at most |n|-1, acyclic and the degree of n can be at most 2. A good binary tree for storing and retrieving data is the heap. Binary tries are less known but have some applications in fast queueing and forwarding although I will have to say no one uses them instead they just use normal tries usually with 4-8 children.
Anonymous No.106914896 [Report]
>>106914762 (OP)
Write a game and you're gonna realize that data structures are you best friend.
Anonymous No.106914913 [Report]
>>106914762 (OP)
Seems like the plan here is writing your "tree" as an array of fixed size, presumably cause your target audience can't into dynamic memory management yet.
Anonymous No.106914957 [Report]
You can either store it in memory and save compute or save memory and burn compute
sage No.106915020 [Report]
All the trees are just natural progressions on the linked list.

Once you know linked list you can intuitively guess the others.
Anonymous No.106915027 [Report] >>106915210 >>106916443 >>106918963 >>106918973
>>106914887
>>106914888
My question is why are all the examples wrong?
I know what a binary tree is, that's why I'm asking why all these places go into depth with jargon but their only examples are unsorted, useless data trees written like arrays
Anonymous No.106915097 [Report]
>>106914814
I code machine code, it's the languages that lie
Anonymous No.106915210 [Report] >>106921242
>>106915027
binary search tree is what you're looking for? binary tree by itself has no ordering
Anonymous No.106915219 [Report]
>>106914762 (OP)
>Every example of a binary tree is like image related
Well, it is a binary tree and there's nothing inherently wrong with it. You either have more context than I do or you're assuming stuff you weren't supposed to assume.
Anonymous No.106915322 [Report] >>106923523
Huh im taking dsa 1 right now and they use binary tree and binary search tree pretty interchangeably im pretty sure. Didn't even know that non ordered binary trees were good for anything. Did you know there's also b trees, avl trees, red black trees, and splay trees? Also some other ones but I think those were the ones that mattered. Oh yeah and heaps. Hey wait those are all min heaps, weird they use them as the poster child for binary trees.
Anonymous No.106915345 [Report] >>106915826
>>106914762 (OP)
Anonymous No.106915371 [Report]
>>106914762 (OP)
I havent used anything more than a hashmap in the last 7 years
Anonymous No.106915381 [Report] >>106915458
In different “Collection” implementations, underneath the library calls trees and linked lists and graphs are used to implement them
You should know the general ideas to pick the correct implementation for a task
Rarely will you make your own but it could happen in the embedded space where theres an extremely limited amount of resources and lightweight libraries
This new capcha is retarded too much effort to post, gay
Anonymous No.106915458 [Report]
>>106915381
Java doesn't have a bst module you have to make your own desu. Actually I just did some googling and it turns out java treeMaps are red black trees i could have just used that instead of wasting an afternoon thanks a lot anon...
Anonymous No.106915826 [Report] >>106917299
>>106915345
what android emulator is that
Anonymous No.106915910 [Report]
>>106914762 (OP)
Some people understand (someone invented the data structures after all) but most do not. Even many people who should know (e.g. UW allen school students who are forced to implement avl trees and red-black trees as part of their cs coursework) don’t have a fucking clue.
Anonymous No.106915973 [Report]
>>106914762 (OP)
I know how they work but I always forget after I while because I just use stuff that is already implemented and rarely to care about their inners workings.
Anonymous No.106916212 [Report]
>>106914863
It simplifies your algorithm (and through that runtime)
say you want to retrieve 8, you just go towards the power of 2, the left pointer every time. Say you want 10 then alternate
symmetry gives you the rest
Anonymous No.106916443 [Report] >>106916698 >>106918080 >>106920020
>>106915027
Since every other poster is retarded I’ll try and answer your question. They are probably ignoring the contents of the tree to focus on the structure. Or the nodes are labeled in the order a BFS would visit them. Or those are retarded sources, find a better place to learn from, like https://ocw.mit.edu/courses/1-00-introduction-to-computers-and-engineering-problem-solving-spring-2012/8ec217685b76f7477cce2403878f5c97_MIT1_00S12_Lec_37.pdf
Anonymous No.106916698 [Report] >>106916796
>>106916443
this is just a 100 course aimed at high-schoolers. zero proofs why any of this works.
Anonymous No.106916796 [Report]
>>106916698
Then go to the 200 level course. Or just stop google image searching “binary tree” to try and learn how it works. ChatGPT would be better than that.
Anonymous No.106916804 [Report]
Im just going to airdrop tokens with typescript chud
Anonymous No.106917299 [Report]
>>106915826
waydroid
Anonymous No.106918080 [Report]
>>106916443
They're just minheaps.
Anonymous No.106918963 [Report]
>>106915027
they are labeling the nodes anon its obviously not the data for which the binary tree is sorted.
Anonymous No.106918973 [Report] >>106919672
>>106915027
how arrogant do you have to be to believe everyone else is wrong and not you? seek help brother
Anonymous No.106919672 [Report] >>106920020
>>106918973
t. draws wrongly sorted binary trees.
Anonymous No.106920020 [Report] >>106920396
>>106919672
A binary tree isn't by definition ordered.
>>106916443
This retard already attempted to say the same thing but poorly explained.

A binary tree is very simply a tree where a vertex can have at most two children. That's it. There are no other special characteristics. You can structure vertices such that a binary tree has a specific ordering. You are overthinking it or listened to some popsci jeetcode mong on Youtube who mixed or conflated terms. If you want a specific and helpful ordering of the vertices in a binary tree then a binary search tree, heap, red black tree, or if you want to be autistic an AVL tree are what you are looking for.
Anonymous No.106920396 [Report] >>106920643
>>106920020
Usecase for an unsorted binary tree?
Anonymous No.106920643 [Report] >>106921096
>>106920396
Usecase for a graph?
Anonymous No.106921096 [Report] >>106921156
>>106920643
Debug unsorted binary trees( because they are obviously faulty)
Anonymous No.106921156 [Report]
>>106921096
You remind me of a stupid gorilla nigger moron I once met who did not believe that the halting problem was real.
Anonymous No.106921242 [Report] >>106921336
>>106915210
>this anon is the only of all who got it
holy shit how dumb you all are
Anonymous No.106921336 [Report]
>>106921242
But they arent unsorted they're minheaps.
Anonymous No.106923523 [Report] >>106926473
>>106915322
>avl trees, red black trees, and splay trees?
A lot of the things you're forced to learn in classes are unfortunately outdated trash that was superseded by better designs or better hardware. RB trees being used internally in some language std libs like Java and C++ especially was a mistake.

First thing you should learn is take big O with a grain of salt because the theoretic complexities of a lot of structures/operations conflict with the reality of memory and how CPUs work
Anonymous No.106923568 [Report]
>>106914762 (OP)
No one has ever taken computer science.
Anonymous No.106923890 [Report]
>>106914762 (OP)
wtf i never realized that, even the wikipedia page has it wrong. what the hell
Anonymous No.106926473 [Report]
>>106923523
So linux using rb trees was a mistake?