Algorithms: Recursion

preview_player
Показать описание
Learn the basics of recursion. This video is a part of HackerRank's Cracking The Coding Interview Tutorial with Gayle Laakmann McDowell.
Рекомендации по теме
Комментарии
Автор

What software are these videos using to draw?

adambeck
Автор

Thank you for these clear explanations.

vincenr
Автор

Not all programs which can be done recursively can be done iteratively. Running asynchronous code in waterfall is one example of this.

julienbongars
Автор

Thanks for the video. However it could be better if the code examples where written incrementally at the same rate you explain the logic.

bkramzi
Автор

We can simply remove recursion f e from binary search or merge sort (bottom up approach for arrays, natural merge for lists)
but from quick sort (i prefer the name partition sort because it may slow to n^2) we have to use own stack to symulate recursion

holyshit
Автор

@HackerRank: Please explain us the drawback of recursive solution and behind the scenes, how it works w.r.t. memory. (Stack memory)!

aniruddhashevle
Автор

What I struggle with regarding recursion is passing in the right number of parameters for an optimized, clean solution.

For example: you may be able to find the height of a binary tree recursively by passing in an int h argument to serve as the increment, but you can also do it just passing in no args and return 1 + recursive steps left/right and taking the max of that

Another example is finding the max sum of a path in a tree: to do so you don't want to pass in the max value to be evaluated against in every call (because the value of max varies by the value stored to the call stack) and instead want to keep a running max globally accessible across all recursive calls.

Or if you want to build a path such as a topology, whether or not you should pass in a list to contain each node, or if you can get away with creating the list as part of the recursion and return that

A video/resource on recursive patterns could be very helpful.

sean
Автор

For my algorithms class our first little project is to write a recursive c++ function that reverses words in a sentence.

Example:
Input: “hello to everyone reading”
Output: “reading everyone to hello”

No vectors or stacks allowed and the function can’t return anything. Surprisingly difficult.

rban
Автор

at 1:05 that shouldn't be count += return countTxt(subdir); ??

gabkov
Автор

Hello Gayle, what russian book "Карьера программста" is doing on your desk there?

denyskovalenko
Автор

I think there may be an error: AFAIK, only functions which can be made tail recursive can be transformed into iterative functions. I'd like to know if I am correct or not.

doubleplusgreat
Автор

lmao that mouse in the diagram xD wire going in through the wrong side xDD

AhmedSiddiqui
Автор

Were is the continuation for this next video ??

saiprathap
Автор

triangles have 1 2 3 lines the least amount possible to make a shape besides 0 a circle. lets say we have triangle xyz and all we know is 1 2 3. if we cycle though both of them back and forth we get infinite yet each set represents 0 and 1
1 x
2 3 y z

spooky_zen
Автор

4:42 slow down to 0.5 speed. She sounds so wasted lmao

sergeif
Автор

Confusingly It's suitably different from iteration.
 Recursive functions must keep the function records in memory
and jump from one memory address to another witch can be worse for performance

iterating while (true)

recursion repeating a function so repeatedly calling a mechanism, and consequently givingyou the overhead, of method calls
Iteration
terminates when the loop-continuation condition fails; recursion terminates when a
base case is recognized.

Douglas-vwou
Автор

I'm so disappointed in my skills as a developer. After watching these videos on data structures and algorithms. I'm so overwhelmed at so much I don't understand. 😭

vic__
Автор

Is there something I should study or know before watching this that helps to understand?

r.a.
Автор

So factorial & Fibonacci are 2 examples of recursion, what else is there to try?

igrewold
Автор

Had high hopes, but this did not help understand recursion (which I already know) or algorithms. Also, HackerRank questions are a bunch of dribble meant to confuse - not evaluate software engineers. Codility is way better, like night and day. Triplebyte is also better. HackerRank is a hack organization. I really am offended by their challenges. They are useless and pointless, obsolete and obscure, purposefully confusing, and pretending to be smart, but at the user's expense.

paulshorey