This Data Structure could be used for Autocomplete

  Рет қаралды 42,239

Tsoding Daily

Tsoding Daily

Күн бұрын

Пікірлер: 95
@lame_lexem
@lame_lexem 2 жыл бұрын
mom can we have emacs no we have emacs at home emacs at home: 42:05
@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.
@miniflint2423
@miniflint2423 10 ай бұрын
How could I achieve something like this guy do. He’s so good
@arkadiymel5987
@arkadiymel5987 2 жыл бұрын
you can mark the end of the word not with bool flag, but instead put empty node at \0 in children
@derekburlingame213
@derekburlingame213 2 жыл бұрын
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 2 жыл бұрын
@@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.
@lolcat69
@lolcat69 6 ай бұрын
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
@ratherbyexploring4898
@ratherbyexploring4898 2 жыл бұрын
Missed opportunity to call this repo "Tsrie"
@zahir.parker
@zahir.parker Ай бұрын
Which font is this ?
@lishugupta
@lishugupta 2 жыл бұрын
U earned a sub just by the title of video🔥🔥
@hrisheekeshdandekar5126
@hrisheekeshdandekar5126 2 жыл бұрын
What is the theme this guy is using???
@petsesto
@petsesto 2 жыл бұрын
34:17 children[69] ... Tsodin nooooo🤣
@trejohnson7677
@trejohnson7677 2 жыл бұрын
We have the same brain but not the same muscle memory or gut.
@dream11tatyabichoo92
@dream11tatyabichoo92 4 ай бұрын
how to donate from India
@L1Q
@L1Q 2 жыл бұрын
29:03 cope
@miezekatze3536
@miezekatze3536 2 жыл бұрын
Where is Emacs?
@tokiomutex4148
@tokiomutex4148 2 жыл бұрын
error: Where: command not found
@sahilbaori9052
@sahilbaori9052 2 жыл бұрын
@@tokiomutex4148 Lame.
@tokiomutex4148
@tokiomutex4148 2 жыл бұрын
@@sahilbaori9052 error: Lame.: command not found.
@yukwa8672
@yukwa8672 2 жыл бұрын
🔥🔥
@tobeypeters
@tobeypeters 2 жыл бұрын
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 2 жыл бұрын
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 2 жыл бұрын
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.)
@tokiomutex4148
@tokiomutex4148 2 жыл бұрын
So you're using Vim now
@MoeQ_
@MoeQ_ 2 жыл бұрын
discord link please ?
@qerdcv
@qerdcv 2 жыл бұрын
Второй
@dibyojyotibhattacherjee4279
@dibyojyotibhattacherjee4279 2 жыл бұрын
Why no cpp?
@latinoce
@latinoce 2 жыл бұрын
why cpp
@dibyojyotibhattacherjee4279
@dibyojyotibhattacherjee4279 2 жыл бұрын
@@latinoce cuz, it's an awesome language.
@avananana
@avananana 2 жыл бұрын
@@dibyojyotibhattacherjee4279 brainfuck is an awesome language as well
@dibyojyotibhattacherjee4279
@dibyojyotibhattacherjee4279 2 жыл бұрын
@@avananana Haven't used it before, gonna check it today, thanks for the suggestion 🙂
@dibyojyotibhattacherjee4279
@dibyojyotibhattacherjee4279 2 жыл бұрын
@@SimGunther ohh, yea, Tsoding's subscribers are really nice people.
@experiment0003
@experiment0003 2 жыл бұрын
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 2 жыл бұрын
If I could just code 4 times slower than him, I would be a respected member of my team
@venkateshgunda25
@venkateshgunda25 2 жыл бұрын
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 2 жыл бұрын
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 Жыл бұрын
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.
@dingalong14
@dingalong14 2 жыл бұрын
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
@arroba3218
@arroba3218 2 жыл бұрын
THIS is what programming looks like. I'm into web development, I don't feel a programmer at all
@JustSomeAussie1
@JustSomeAussie1 2 жыл бұрын
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 5 ай бұрын
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.
@kernelk1931
@kernelk1931 2 жыл бұрын
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.
@Rohan-bg8ci
@Rohan-bg8ci 2 жыл бұрын
"That is much productive than Java enterprise edition developer" -chad Tsoding
@DJohn001
@DJohn001 2 жыл бұрын
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
@Teacher_Ali
@Teacher_Ali 2 жыл бұрын
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.
@coffee-is-power
@coffee-is-power 2 жыл бұрын
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?
@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
@bigbluebiosphere
@bigbluebiosphere Жыл бұрын
commit-ee commit-ee pushy-ee pushy-ee made me LMAO. But nowhere near as much as cucumbersome did.
@alexzander__6334
@alexzander__6334 2 жыл бұрын
you just moved to vim from emacs?
@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!!
@trungthanhbp
@trungthanhbp 2 жыл бұрын
this guy is funny, haha
@lieryan9137
@lieryan9137 2 жыл бұрын
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 2 жыл бұрын
How would this approach work with Unicode? Would the search be `"...A"
@s000x
@s000x Жыл бұрын
Ur emacs config got me to patch my neovim so current line number is aligned with relnum lol
@kuwapt951
@kuwapt951 2 жыл бұрын
Hello hello
@Simon-xi8tb
@Simon-xi8tb 2 жыл бұрын
Unrelated: How can I get accepted into discord ? I joined the server, but can't type messages. I did accept the rules
@MaxHeroGamer
@MaxHeroGamer 2 жыл бұрын
The go thing made me thing why Erlang is so brilliant.
@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.
@rogo7330
@rogo7330 2 жыл бұрын
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.
@bonchonmaru
@bonchonmaru 11 ай бұрын
1:47:12 is it possible to prevent stackoverflow in `print_autocomplete` for deep trees?
@TsodingDaily
@TsodingDaily 11 ай бұрын
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.
@crankyunicorn4423
@crankyunicorn4423 2 жыл бұрын
Yello!
@ItzAnameOk
@ItzAnameOk Жыл бұрын
Amazing
@هلالمجيد-ظ3ك
@هلالمجيد-ظ3ك 2 жыл бұрын
What kind of linux does he use?
@narigoncs
@narigoncs 2 жыл бұрын
Debian
@hindenburg3038
@hindenburg3038 2 жыл бұрын
Where I can get the link to his discord server?
@csbnikhil
@csbnikhil 2 жыл бұрын
Twitch About Page
@archavez100
@archavez100 2 жыл бұрын
How did you zoom and add that spotlight to your cursor? At 11:08
@iuc7254
@iuc7254 Жыл бұрын
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
@Q_20
@Q_20 2 жыл бұрын
proud to be a reckless java code duplicator
@johndowson1852
@johndowson1852 2 жыл бұрын
1:08 CAN YOUR GITHUB DO THIS?
@tentative_flora2690
@tentative_flora2690 2 жыл бұрын
I hadn't thought before about someone using recursion in an intuitive solution before. This was really cool.
@yramagicman675
@yramagicman675 2 жыл бұрын
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 2 жыл бұрын
@@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 2 жыл бұрын
@@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.
Using C instead of Bash
1:14:06
Tsoding Daily
Рет қаралды 41 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 81 М.
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 6 МЛН
Стойкость Фёдора поразила всех!
00:58
МИНУС БАЛЛ
Рет қаралды 3,3 МЛН
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
What is Relative Pointers?
1:51:27
Tsoding Daily
Рет қаралды 33 М.
Writing a game the hard way - from scratch using C. #1
34:20
NCOT Technology
Рет қаралды 128 М.
Andrew Kelley   Practical Data Oriented Design (DoD)
46:40
ChimiChanga
Рет қаралды 107 М.
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 81 М.
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,1 МЛН
Let's Talk About Functional Programming
1:47:07
Tsoding Daily
Рет қаралды 71 М.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 87 М.
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,7 МЛН
Real Programmers Write Machine Code
26:25
ThePrimeTime
Рет қаралды 112 М.
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 6 МЛН