This Data Structure could be used for Autocomplete

  Рет қаралды 43,471

Tsoding Daily

Tsoding Daily

Күн бұрын

Пікірлер: 93
@lame_lexem
@lame_lexem 3 жыл бұрын
mom can we have emacs no we have emacs at home emacs at home: 42:05
@kernelk1931
@kernelk1931 3 жыл бұрын
looks like you've uploaded a brand new quality content, tsoding!!
@larryd9577
@larryd9577 2 жыл бұрын
Instead of maintaining a bool in every node: A memory-efficient solution (for reasonably large trees) for marking the end would be to use a guard-noded (one should be enough) which is inserted as a leaf of every end of a word.
@dingalong14
@dingalong14 3 жыл бұрын
Haven't watched in a couple of weeks, glad to see you've switched to the *objectively superior* text editor. Jokes aside, nice stream. I always pick up at least one or two little things I didn't know about previously.
@Nick-lx4fo
@Nick-lx4fo 2 жыл бұрын
Gedit, you mean, is the objectively superior text editor
@experiment0003
@experiment0003 3 жыл бұрын
So, this guy could work for any company he wants (Google, Tesla, Amazon, etc) and be a senior engineer at the least! instead, he chooses to make his living via streaming.
@Chaosman88
@Chaosman88 3 жыл бұрын
If I could just code 4 times slower than him, I would be a respected member of my team
@venkateshgunda25
@venkateshgunda25 3 жыл бұрын
It could be because at a large company, coding only comprises about 40 to 50 per cent of the time. Rest is projects, meetings, presentations and other corporate BS that eats up valuable time.
@richienguyen2703
@richienguyen2703 3 жыл бұрын
not every software engineer wants to work for big tech companies. They're all big so their development process is more bureaucratic, and some people just purely love coding.
@AndrewTSq
@AndrewTSq 2 жыл бұрын
agile ruins the fun of coding.
@BboyKeny
@BboyKeny Жыл бұрын
@@dill__pickles Well you are a God on earth. So all other people, aside from you, fit your description.
@bart2019
@bart2019 Жыл бұрын
2k per node is not a lot for modern computers, but at 1024 nodes per tree that is 2MB, and that is a lot for modern CPU caches. On its own you won't notice it, but on a heavily loaded computer you might notice it because 2MB is easily a quarter of the entire CPU cache. In this case, a theoretically much slower approach but with a much much compact storage, for example with a simple comparison loop in a linked list, would put much less strain on the cache.
@arroba3218
@arroba3218 3 жыл бұрын
THIS is what programming looks like. I'm into web development, I don't feel a programmer at all
@JustSomeAussie1
@JustSomeAussie1 3 жыл бұрын
Because you're not :)
@lonelyfloat2582
@lonelyfloat2582 2 жыл бұрын
Just do what you enjoy doing, doing anything else (unless it's for a job or something similar obviously) is stupid IMO
@Leonhart_93
@Leonhart_93 8 ай бұрын
Not sure what people work on in web dev to say that they don't do stuff like this. Writing elegant programs that do a specific task efficiently should be the target in anything you use. If I write a 1000 line JS program for a specific page to have some arcane functionality, then it's clear that I need to apply a lot of programming paradigms to do it well.
@Rohan-bg8ci
@Rohan-bg8ci 3 жыл бұрын
"That is much productive than Java enterprise edition developer" -chad Tsoding
@N00byEdge
@N00byEdge Жыл бұрын
Another way to indicate the end of a word is to set index 0 of the children array to something, just like you would have a null terminator in a c-style string
@geovanniportilla7159
@geovanniportilla7159 2 жыл бұрын
Pure data structure, algorithm, and design. This is pure gold. I follow your content and here is an idea: maybe, would be nice to have a project that created a programming language for database management. I don't know something basic: relational algebra, join, or some k-tree search algorithms. May be is something you are not working in the past and it's challenging for you. Peace!!
@lieryan9137
@lieryan9137 3 жыл бұрын
For the use case of autocomplete, especially one that needs to work on Unicode, I think a regular binary search tree would work better than a trie. For finding candidate completions, you'll want a binary tree search implementation that returns all nodes in a range. For example, if you want to find all words that has a prefix of "sal", you'll want a search function that returns all nodes whose values matches `"sal"
@edusandalo
@edusandalo 3 жыл бұрын
How would this approach work with Unicode? Would the search be `"...A"
@keldwikchaldain9545
@keldwikchaldain9545 Жыл бұрын
To compress memory the primary way would be to use an array mapped trie, which trades memory footprint for increased memory allocations, but with pooling that can be reduced as well.
@Teacher_Ali
@Teacher_Ali 3 жыл бұрын
One of the coolest channels on internet world.
@geovanniportilla7159
@geovanniportilla7159 2 жыл бұрын
This dude is just insane!!! Pure data estructure, algorithm and design. This is pure gold.
@DJohn001
@DJohn001 3 жыл бұрын
Hello, what's the reason that you're not binding your local branch with your remote one? for example: `git push -u origin ` then you did have to type your branch each time you commit. Instead you can just use `git push`
@froggoboom
@froggoboom 2 жыл бұрын
the man types fast
@bigbluebiosphere
@bigbluebiosphere 2 жыл бұрын
commit-ee commit-ee pushy-ee pushy-ee made me LMAO. But nowhere near as much as cucumbersome did.
@bonchonmaru
@bonchonmaru Жыл бұрын
1:47:12 is it possible to prevent stackoverflow in `print_autocomplete` for deep trees?
@TsodingDaily
@TsodingDaily Жыл бұрын
You probably can by using a bigger stack. Which might mean increasing the size of the callstack itself or implementing a non-recursive solution that maintains its own stack. In the later case you can have whatever size of the stack you want.
@lishugupta
@lishugupta 3 жыл бұрын
U earned a sub just by the title of video🔥🔥
@petsesto
@petsesto 3 жыл бұрын
34:17 children[69] ... Tsodin nooooo🤣
@miniflint2423
@miniflint2423 Жыл бұрын
How could I achieve something like this guy do. He’s so good
@archavez100
@archavez100 3 жыл бұрын
How did you zoom and add that spotlight to your cursor? At 11:08
@iuc7254
@iuc7254 2 жыл бұрын
He wrote an application in nim to help him do that.... you can find it on one of his github repos under the name of Boomer
@MaxHeroGamer
@MaxHeroGamer 2 жыл бұрын
The go thing made me thing why Erlang is so brilliant.
@arkamel5987
@arkamel5987 3 жыл бұрын
you can mark the end of the word not with bool flag, but instead put empty node at \0 in children
@derekburlingame213
@derekburlingame213 3 жыл бұрын
That doesn't work for cases where words like "dog" and "dogged" are both in the structure, since the first 'g' would have children, but also be the end of a word.
@DylanNelsonSA
@DylanNelsonSA 3 жыл бұрын
@@derekburlingame213 They meant adding a node at index 0, not having 0 children. So it would be like treating the word as a c-style string with a null terminator.
@coffee-is-power
@coffee-is-power 3 жыл бұрын
you dont need to create the project, when you push to an repository that doesnt exist and you have permission to create repositories, it creates automatically
@baka_geddy
@baka_geddy 2 жыл бұрын
How so? Can you share it?
@lolcat69
@lolcat69 9 ай бұрын
It would be interesting to use this data structure for AI, imagine like passing binary files to this and passing ut to an AI, it could figure out a file is X type based on the signature or smth and ut would learn to clasify files or smth like that
@ItzAnameOk
@ItzAnameOk 2 жыл бұрын
Amazing
@tobeypeters
@tobeypeters 3 жыл бұрын
Did you say, There’s no Switch...case in c?, around 1:18:00 ? Idk ... Anyhow would love to see how to do this in python.
@TsodingDaily
@TsodingDaily 3 жыл бұрын
No, I didn't say that there is no switch-case in c. Please listen to what I've said again. You missed two important words.
@ricoh51
@ricoh51 3 жыл бұрын
No switch for string 😉
@anon_y_mousse
@anon_y_mousse 2 жыл бұрын
@@TsodingDaily Fun fact, AMD's optimization manual had an example of how to simulate string switching by hashing constants ahead of time. With C++'s constexpr you could have base that allowed adding words with minimal effort. (Hopefully you'll be back and posting in the near future.)
@ratherbyexploring4898
@ratherbyexploring4898 2 жыл бұрын
Missed opportunity to call this repo "Tsrie"
@tentative_flora2690
@tentative_flora2690 3 жыл бұрын
I hadn't thought before about someone using recursion in an intuitive solution before. This was really cool.
@yramagicman675
@yramagicman675 3 жыл бұрын
Once you start working with recursion it becomes more and more intuitive. There are a number of problems that are actually easier to solve with recursion than they are with iteration. Zipping 2 arrays is one example of this that I used recently. I implemented the recursive algorithm for it in less time than it would have taken to figure out how to do it iteratively.
@tentative_flora2690
@tentative_flora2690 3 жыл бұрын
@@yramagicman675 I guess I am so used to trying to stuff things into while loops I miss out on a lot of good use cases.
@yramagicman675
@yramagicman675 3 жыл бұрын
@@tentative_flora2690 get out of your comfort zone and try a language that forces you to use recursion. Lisps are an easy way to do that, and the easiest one of those to get started with is probably Racket. I really enjoy Racket. It has taken Pythons place as my go to language for basic scripting.
@yukwa8672
@yukwa8672 3 жыл бұрын
🔥🔥
@hrisheekeshdandekar5126
@hrisheekeshdandekar5126 2 жыл бұрын
What is the theme this guy is using???
@L1Q
@L1Q 2 жыл бұрын
29:03 cope
@hindenburg3038
@hindenburg3038 3 жыл бұрын
Where I can get the link to his discord server?
@csbnikhil
@csbnikhil 3 жыл бұрын
Twitch About Page
@trungthanhbp
@trungthanhbp 3 жыл бұрын
this guy is funny, haha
@s000x
@s000x Жыл бұрын
Ur emacs config got me to patch my neovim so current line number is aligned with relnum lol
@alexzander__6334
@alexzander__6334 3 жыл бұрын
you just moved to vim from emacs?
@zahir.parker
@zahir.parker 4 ай бұрын
Which font is this ?
@trejohnson7677
@trejohnson7677 3 жыл бұрын
We have the same brain but not the same muscle memory or gut.
@rogo7330
@rogo7330 3 жыл бұрын
Not watched the whole video yet, but what i think is storing pointers to every character is kinda pointless. What we are really care about is branches. That saying we really wanna store pointers to each individual string (null-terminated, btw, that way we not gonna waste 2kibi on each character lol) and then just cat them together. Btw, we can do the same trick with null termination with our pointers! LMAO А потом всё превратится в ад из незнания сколько на самом деле памяти занимает наша программа, кек
@anon_y_mousse
@anon_y_mousse 2 жыл бұрын
Exactly, and then the index into the string and a length. That said, I really wish people would stop using those ldlotic prefixes. Other than storage device manufacturers who rip people off, no one ever meant kilobyte as 1000 bytes. I will never use those prefixes and just keep saying kilobyte and meaning 1024.
@miezekatze3536
@miezekatze3536 3 жыл бұрын
Where is Emacs?
@tokiomutex4148
@tokiomutex4148 3 жыл бұрын
error: Where: command not found
@sahilbaori9052
@sahilbaori9052 3 жыл бұрын
@@tokiomutex4148 Lame.
@tokiomutex4148
@tokiomutex4148 3 жыл бұрын
@@sahilbaori9052 error: Lame.: command not found.
@هلالمجيد-ظ3ك
@هلالمجيد-ظ3ك 2 жыл бұрын
What kind of linux does he use?
@narigoncs
@narigoncs 2 жыл бұрын
Debian
@johndowson1852
@johndowson1852 3 жыл бұрын
1:08 CAN YOUR GITHUB DO THIS?
@kuwapt951
@kuwapt951 3 жыл бұрын
Hello hello
@dream11tatyabichoo92
@dream11tatyabichoo92 7 ай бұрын
how to donate from India
@MoeQ_
@MoeQ_ 3 жыл бұрын
discord link please ?
@Q_20
@Q_20 3 жыл бұрын
proud to be a reckless java code duplicator
@tokiomutex4148
@tokiomutex4148 3 жыл бұрын
So you're using Vim now
@dibyojyotibhattacherjee4279
@dibyojyotibhattacherjee4279 3 жыл бұрын
Why no cpp?
@latingm
@latingm 3 жыл бұрын
why cpp
@dibyojyotibhattacherjee4279
@dibyojyotibhattacherjee4279 3 жыл бұрын
@@latingm cuz, it's an awesome language.
@avananana
@avananana 3 жыл бұрын
@@dibyojyotibhattacherjee4279 brainfuck is an awesome language as well
@dibyojyotibhattacherjee4279
@dibyojyotibhattacherjee4279 3 жыл бұрын
@@avananana Haven't used it before, gonna check it today, thanks for the suggestion 🙂
@dibyojyotibhattacherjee4279
@dibyojyotibhattacherjee4279 3 жыл бұрын
@@SimGunther ohh, yea, Tsoding's subscribers are really nice people.
@qerdcv
@qerdcv 3 жыл бұрын
Второй
Let's Talk About Functional Programming
1:47:07
Tsoding Daily
Рет қаралды 75 М.
Coding a Bouncing Ball in Terminal
1:26:29
Tsoding Daily
Рет қаралды 82 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
What is Relative Pointers?
1:51:27
Tsoding Daily
Рет қаралды 34 М.
Using C instead of Bash
1:14:06
Tsoding Daily
Рет қаралды 42 М.
Hot Code Reloading in C
2:16:18
Tsoding Daily
Рет қаралды 68 М.
Faster than Rust and C++: the PERFECT hash table
33:52
strager
Рет қаралды 611 М.
Hiding Information Inside of PNG
1:53:49
Tsoding Daily
Рет қаралды 49 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
Implementing Scientific Paper in C
4:42:54
Tsoding Daily
Рет қаралды 44 М.
Advanced C: The UB and optimizations that trick good programmers.
1:12:34
Eskil Steenberg
Рет қаралды 178 М.
I made Futures from scratch
1:56:09
Tsoding Daily
Рет қаралды 29 М.
Searching Duplicate Files with C
2:39:23
Tsoding Daily
Рет қаралды 37 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН