Recursion
Recursion ๐๏ธโ๐จ๏ธ
Courtesy of @inside.code
โ
Follow to learn more programming tips!
Wikipedia definition
Recursion in computer science is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem (as opposed to iteration). The approach can be applied to many types of problems, and recursion is one of the central ideas of computer science.
Example
Letโs suppose we want to calculate n!, we know that n! = n (n โ 1)!, and (n โ 1)! = (n โ 1) * (n-2)!, and we can continue like this until arriving to 0! which is 1, so we need what we call a base case to stop the recursion, otherwise the function would run endlessly
Example: sum of numbers from 1 to N
But the power of recursion doesnโt stop in these two examples, it can be used to solve more complex problems, we can use it for example in binary search or to find all subsequences of a string.
Bonus โ 8 useful tools for everyday usage:
Integromat โ is a powerful automation tool that connects your apps and services to work smarter, not harder.
Leadpages โ lets you build beautiful, high-converting websites, unlimited landing pages, pop-up forms you can add to your other websites.
GetResponse โ an email marketing platform that enables you to create a valuable marketing list of prospects, partners, and clients, so you can develop relationships with them and build a responsive and profitable customer base.
Manychat โ visual bot builder for Facebook Messenger with broadcasts, analytics, scheduled posting and many other features!
Funnelytics โ the best funnel mapping software available to marketers and entrepreneurs today.
FlyWheel โ is managed WordPress hosting built for designers and creative agencies.
Crello โ a free graphic design editor that helps create images for social media, print, and other web-based graphics.
FlowKit โ allows designers to create frighteningly fast user flows within Sketch and Figma.
Be free to send us any feedback by reply or reach us in DM on Instagram
Do you want to receive insights using FB Messenger or Telegram or Email? ๐ Subscribe now.