SlideShare a Scribd company logo
1 of 27
Intro to
Recursion
What is
recursion?
Throughout your computer science journey so
far, you’ve most likely heard of iteration and
multiple iteration, which is repeating a
particular block of code for a certain amount of
times until you stop
These are represented as FOR loops and
WHILE loops
But iteration may not be the only way to solve
certain problems, and there may even be a
better way
An alternative way for programming problem
solving is called recursion
What is recursion?
Recursion happens when a function calls
ITSELF. This can be a strange concept for you
to wrap your head around. But it CAN be done
We will be building a recursive function to return
the factorial of a number. A factorial is the
product of a number and all the positive integers
that are smaller than it
(For all intents and purposes, this will be in
pseudocode so you can use any language you
want for your examples)
We will call this function factorial (int
number)
Recursion
Recursion
Recursion
Recursion
Recursion
Recursion
Recursion
Recursion
What is recursion?
The factorial function takes in ONE
parameter and that’s the number we are
trying to find the factorial of. Let’s assume
that no-one will input a number less than 1
There are 2 parts to a recursive function:
The first is the base case, which is critical for
getting our recursive function to EXIT
if(number == 1){
return 1;
}
We already know that the factorial of 1 is 1,
so we can say:
What is recursion?
We can write the recursive step as:
return number * factorial(number – 1).
Our completed function is:
int factorial (int number) {
if number == 1
return 1
return number * factorial(number – 1);
}
The next part is the recursive
step. This is where we get the
function to call itself. What do we
know about factorials? That the
factorial of a number CAN be
equal to the number itself
[multiplied by] the factorial of the
previous number
What is recursion?
Now let’s put a number into this function
as an example and see how we do, and
see how recursive functions operate
Factorial (4) 4 · Factorial (3)
=
3 · Factorial (2)
2 · Factorial (1)
Let’s try 4:
Every time we call the recursive function,
it gets pushed to the top of the stack until
we hit a base case (number = 1). Then
that value gets returned and all the
recursive calls get popped off the stack
one by one. 4 * 3 * 2 * 1 = 24, which IS 4!
This was a small intro to recursion!
CREDITS: This presentation template was
created by Slidesgo, and includes icons by
Flaticon, infographics & images by Freepik
and contents by Swetha Tandri
Thanks
Do you have any questions?
youremail@freepik.com
+91 620 421 838
yourwebsite.com
Please keep this slide for attribution
Alternative resources
Here’s an assortment of alternative resources whose style fits that of this template:
Vectors
● Desktop and smartphone app development
Resources
Did you like the resources on this template? Get them on our other websites.
Vectors
● Flat cms concept in blue shades
Instructions for use
If you have a free account, in order to use this template, you must credit Slidesgo by keeping the Thanks slide. Please
refer to the next slide to read the instructions for premium users.
As a Free user, you are allowed to:
● Modify this template.
● Use it for both personal and commercial projects.
You are not allowed to:
● Sublicense, sell or rent any of Slidesgo Content (or a modified version of Slidesgo Content).
● Distribute Slidesgo Content unless it has been expressly authorized by Slidesgo.
● Include Slidesgo Content in an online or offline database or file.
● Offer Slidesgo templates (or modified versions of Slidesgo templates) for download.
● Acquire the copyright of Slidesgo Content.
For more information about editing slides, please read our FAQs or visit our blog:
https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
As a Premium user, you can use this template without attributing Slidesgo or keeping the Thanks slide.
You are allowed to:
● Modify this template.
● Use it for both personal and commercial purposes.
● Hide or delete the “Thanks” slide and the mention to Slidesgo in the credits.
● Share this template in an editable format with people who are not part of your team.
You are not allowed to:
● Sublicense, sell or rent this Slidesgo Template (or a modified version of this Slidesgo Template).
● Distribute this Slidesgo Template (or a modified version of this Slidesgo Template) or include it in a database or in
any other product or service that offers downloadable images, icons or presentations that may be subject to
distribution or resale.
● Use any of the elements that are part of this Slidesgo Template in an isolated and separated way from this
Template.
● Register any of the elements that are part of this template as a trademark or logo, or register it as a work in an
intellectual property registry or similar.
For more information about editing slides, please read our FAQs or visit our blog:
https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
Instructions for use (premium users)
This presentation has been made using the following fonts:
Alata
(https://fonts.google.com/specimen/Alata)
Archivo
(https://fonts.google.com/specimen/Archivo)
Fonts & colors used
#041e52 #ffffff #073899 #4f7bc8
#80b2f1 #f4f6f8 #dbe8f1
Create your Story with our illustrated concepts. Choose the style you like the most, edit its colors,
pick the background and layers you want to show and bring them to life with the animator panel!
It will boost your presentation. Check out how it works.
Storyset
Pana Amico Bro Rafiki Cuate
You can easily resize these resources without losing quality. To change the color, just ungroup the resource and click
on the object you want to change. Then, click on the paint bucket and select the color you want. Group the resource again
when you’re done. You can also look for more infographics on Slidesgo.
Use our editable graphic resources...
JANUARY FEBRUARY MARCH APRIL MAY JUNE
PHASE 1
PHASE 2
Task 1
Task 2
Task 1
Task 2
JANUARY FEBRUARY MARCH APRIL
PHASE 1
Task 1
Task 2
You can resize these icons without losing quality.
You can change the stroke and fill color; just select the icon and click on the paint bucket/pen.
In Google Slides, you can also use Flaticon’s extension, allowing you to customize and add even more icons.
...and our sets of editable icons
Educational Icons Medical Icons
Business Icons Teamwork Icons
Help & Support Icons Avatar Icons
Creative Process Icons Performing Arts Icons
Nature Icons
SEO & Marketing Icons
EN Intro to Recursion by Slidesgo.pptx

More Related Content

Similar to EN Intro to Recursion by Slidesgo.pptx

Download What is Chat GPT by Agegamer.com .pptx
Download What is Chat GPT by Agegamer.com .pptxDownload What is Chat GPT by Agegamer.com .pptx
Download What is Chat GPT by Agegamer.com .pptxagegamer247
 
EN Chat GPT by Slidesgo.pptx
EN Chat GPT by Slidesgo.pptxEN Chat GPT by Slidesgo.pptx
EN Chat GPT by Slidesgo.pptxrajibchy198
 
ChatGPT explicado a tus alumnos de secundaria.pptx
ChatGPT explicado a tus alumnos de secundaria.pptxChatGPT explicado a tus alumnos de secundaria.pptx
ChatGPT explicado a tus alumnos de secundaria.pptxxilxesbiblio
 
EN Chat GPT by Slidesgo.pptx
EN Chat GPT by Slidesgo.pptxEN Chat GPT by Slidesgo.pptx
EN Chat GPT by Slidesgo.pptxAditya624834
 
ES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxStRoNgNeTDos1
 
ES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxStRoNgNeTDos1
 
ES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxRogerRodrigoCisneros
 
properties-of-logarithms.pptx
properties-of-logarithms.pptxproperties-of-logarithms.pptx
properties-of-logarithms.pptxAkhilRaj784884
 
printable-cards-for-special-education.pptx
printable-cards-for-special-education.pptxprintable-cards-for-special-education.pptx
printable-cards-for-special-education.pptxCherylFrane1
 
Few minutes To better Code - Refactoring
Few minutes To better Code - RefactoringFew minutes To better Code - Refactoring
Few minutes To better Code - RefactoringDiaa Al-Salehi
 
EN Introduction to Fractions by Slidesgo.pptx
EN Introduction to Fractions by Slidesgo.pptxEN Introduction to Fractions by Slidesgo.pptx
EN Introduction to Fractions by Slidesgo.pptxDarfin
 
ouwihruwiuefwjiu43briuwkjefbiyqwewww.pptxqwflw
ouwihruwiuefwjiu43briuwkjefbiyqwewww.pptxqwflwouwihruwiuefwjiu43briuwkjefbiyqwewww.pptxqwflw
ouwihruwiuefwjiu43briuwkjefbiyqwewww.pptxqwflwMaroofimad
 
Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!Ryan Weaver
 
المعادلات التفاضلية.pptx
المعادلات التفاضلية.pptxالمعادلات التفاضلية.pptx
المعادلات التفاضلية.pptxHaiderIsmail3
 

Similar to EN Intro to Recursion by Slidesgo.pptx (20)

Download What is Chat GPT by Agegamer.com .pptx
Download What is Chat GPT by Agegamer.com .pptxDownload What is Chat GPT by Agegamer.com .pptx
Download What is Chat GPT by Agegamer.com .pptx
 
EN Chat GPT by Slidesgo.pptx
EN Chat GPT by Slidesgo.pptxEN Chat GPT by Slidesgo.pptx
EN Chat GPT by Slidesgo.pptx
 
ChatGPT explicado a tus alumnos de secundaria.pptx
ChatGPT explicado a tus alumnos de secundaria.pptxChatGPT explicado a tus alumnos de secundaria.pptx
ChatGPT explicado a tus alumnos de secundaria.pptx
 
EN Chat GPT by Slidesgo.pptx
EN Chat GPT by Slidesgo.pptxEN Chat GPT by Slidesgo.pptx
EN Chat GPT by Slidesgo.pptx
 
ES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptx
 
ES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptx
 
ES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptxES Second Derivative Test by Slidesgo.pptx
ES Second Derivative Test by Slidesgo.pptx
 
1.pptx
1.pptx1.pptx
1.pptx
 
chat-gpt.pptx
chat-gpt.pptxchat-gpt.pptx
chat-gpt.pptx
 
properties-of-logarithms.pptx
properties-of-logarithms.pptxproperties-of-logarithms.pptx
properties-of-logarithms.pptx
 
printable-cards-for-special-education.pptx
printable-cards-for-special-education.pptxprintable-cards-for-special-education.pptx
printable-cards-for-special-education.pptx
 
Comprensión lectora Lili Lana.pptx
Comprensión lectora Lili Lana.pptxComprensión lectora Lili Lana.pptx
Comprensión lectora Lili Lana.pptx
 
composite-functions.pptx
composite-functions.pptxcomposite-functions.pptx
composite-functions.pptx
 
abc.pptx
abc.pptxabc.pptx
abc.pptx
 
Few minutes To better Code - Refactoring
Few minutes To better Code - RefactoringFew minutes To better Code - Refactoring
Few minutes To better Code - Refactoring
 
EN Introduction to Fractions by Slidesgo.pptx
EN Introduction to Fractions by Slidesgo.pptxEN Introduction to Fractions by Slidesgo.pptx
EN Introduction to Fractions by Slidesgo.pptx
 
ouwihruwiuefwjiu43briuwkjefbiyqwewww.pptxqwflw
ouwihruwiuefwjiu43briuwkjefbiyqwewww.pptxqwflwouwihruwiuefwjiu43briuwkjefbiyqwewww.pptxqwflw
ouwihruwiuefwjiu43briuwkjefbiyqwewww.pptxqwflw
 
plantilla.pptx
plantilla.pptxplantilla.pptx
plantilla.pptx
 
Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!
 
المعادلات التفاضلية.pptx
المعادلات التفاضلية.pptxالمعادلات التفاضلية.pptx
المعادلات التفاضلية.pptx
 

Recently uploaded

Call Girls In Amritsar 💯Call Us 🔝 76967 34778🔝 💃 Independent Escort In Amritsar
Call Girls In Amritsar 💯Call Us 🔝 76967 34778🔝 💃 Independent Escort In AmritsarCall Girls In Amritsar 💯Call Us 🔝 76967 34778🔝 💃 Independent Escort In Amritsar
Call Girls In Amritsar 💯Call Us 🔝 76967 34778🔝 💃 Independent Escort In Amritsaronly4webmaster01
 
Call Girls in Friends Colony 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in Friends Colony 9711199171 Delhi Enjoy Call Girls With Our EscortsCall Girls in Friends Colony 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in Friends Colony 9711199171 Delhi Enjoy Call Girls With Our Escortsindian call girls near you
 
CALL ON ➥8923113531 🔝Call Girls Vineet Khand Lucknow best Night Fun service 🧦
CALL ON ➥8923113531 🔝Call Girls Vineet Khand Lucknow best Night Fun service  🧦CALL ON ➥8923113531 🔝Call Girls Vineet Khand Lucknow best Night Fun service  🧦
CALL ON ➥8923113531 🔝Call Girls Vineet Khand Lucknow best Night Fun service 🧦anilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Fazullaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Fazullaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Fazullaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Fazullaganj Lucknow best sexual serviceanilsa9823
 
VIP Amritsar Call Girl 7001035870 Enjoy Call Girls With Our Escorts
VIP Amritsar Call Girl 7001035870 Enjoy Call Girls With Our EscortsVIP Amritsar Call Girl 7001035870 Enjoy Call Girls With Our Escorts
VIP Amritsar Call Girl 7001035870 Enjoy Call Girls With Our Escortssonatiwari757
 
slideshare Call girls Noida Escorts 9999965857 henakhan
slideshare Call girls Noida Escorts 9999965857 henakhanslideshare Call girls Noida Escorts 9999965857 henakhan
slideshare Call girls Noida Escorts 9999965857 henakhanhanshkumar9870
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Shamshabad high-profile Call ...
VIP 7001035870 Find & Meet Hyderabad Call Girls Shamshabad high-profile Call ...VIP 7001035870 Find & Meet Hyderabad Call Girls Shamshabad high-profile Call ...
VIP 7001035870 Find & Meet Hyderabad Call Girls Shamshabad high-profile Call ...aditipandeya
 
Corporate Presentation Probe May 2024.pdf
Corporate Presentation Probe May 2024.pdfCorporate Presentation Probe May 2024.pdf
Corporate Presentation Probe May 2024.pdfProbe Gold
 
Teck Investor Presentation, April 24, 2024
Teck Investor Presentation, April 24, 2024Teck Investor Presentation, April 24, 2024
Teck Investor Presentation, April 24, 2024TeckResourcesLtd
 
《加州大学圣克鲁兹分校学位证书复制》Q微信741003700美国学历疑难问题指南|挂科被加州大学圣克鲁兹分校劝退没有毕业证怎么办?《UCSC毕业证购买|加...
《加州大学圣克鲁兹分校学位证书复制》Q微信741003700美国学历疑难问题指南|挂科被加州大学圣克鲁兹分校劝退没有毕业证怎么办?《UCSC毕业证购买|加...《加州大学圣克鲁兹分校学位证书复制》Q微信741003700美国学历疑难问题指南|挂科被加州大学圣克鲁兹分校劝退没有毕业证怎么办?《UCSC毕业证购买|加...
《加州大学圣克鲁兹分校学位证书复制》Q微信741003700美国学历疑难问题指南|挂科被加州大学圣克鲁兹分校劝退没有毕业证怎么办?《UCSC毕业证购买|加...wyqazy
 
Sustainability Leadership, April 26 2024
Sustainability Leadership, April 26 2024Sustainability Leadership, April 26 2024
Sustainability Leadership, April 26 2024TeckResourcesLtd
 
Call Girl Kolkata Sia 🤌 8250192130 🚀 Vip Call Girls Kolkata
Call Girl Kolkata Sia 🤌  8250192130 🚀 Vip Call Girls KolkataCall Girl Kolkata Sia 🤌  8250192130 🚀 Vip Call Girls Kolkata
Call Girl Kolkata Sia 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Russian Call Girls Kolkata Amaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Amaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls Kolkata Amaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Amaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Abids high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls Abids high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls Abids high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls Abids high-profile Call Girladitipandeya
 

Recently uploaded (20)

Russian Call Girls Rohini Sector 3 💓 Delhi 9999965857 @Sabina Modi VVIP MODEL...
Russian Call Girls Rohini Sector 3 💓 Delhi 9999965857 @Sabina Modi VVIP MODEL...Russian Call Girls Rohini Sector 3 💓 Delhi 9999965857 @Sabina Modi VVIP MODEL...
Russian Call Girls Rohini Sector 3 💓 Delhi 9999965857 @Sabina Modi VVIP MODEL...
 
Call Girls In Amritsar 💯Call Us 🔝 76967 34778🔝 💃 Independent Escort In Amritsar
Call Girls In Amritsar 💯Call Us 🔝 76967 34778🔝 💃 Independent Escort In AmritsarCall Girls In Amritsar 💯Call Us 🔝 76967 34778🔝 💃 Independent Escort In Amritsar
Call Girls In Amritsar 💯Call Us 🔝 76967 34778🔝 💃 Independent Escort In Amritsar
 
Call Girls in Friends Colony 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in Friends Colony 9711199171 Delhi Enjoy Call Girls With Our EscortsCall Girls in Friends Colony 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in Friends Colony 9711199171 Delhi Enjoy Call Girls With Our Escorts
 
Call Girls In Kalkaji 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Kalkaji 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Kalkaji 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Kalkaji 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
CALL ON ➥8923113531 🔝Call Girls Vineet Khand Lucknow best Night Fun service 🧦
CALL ON ➥8923113531 🔝Call Girls Vineet Khand Lucknow best Night Fun service  🧦CALL ON ➥8923113531 🔝Call Girls Vineet Khand Lucknow best Night Fun service  🧦
CALL ON ➥8923113531 🔝Call Girls Vineet Khand Lucknow best Night Fun service 🧦
 
@9999965857 🫦 Sexy Desi Call Girls Karol Bagh 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Karol Bagh 💓 High Profile Escorts Delhi 🫶@9999965857 🫦 Sexy Desi Call Girls Karol Bagh 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Karol Bagh 💓 High Profile Escorts Delhi 🫶
 
CALL ON ➥8923113531 🔝Call Girls Fazullaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Fazullaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Fazullaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Fazullaganj Lucknow best sexual service
 
VIP Amritsar Call Girl 7001035870 Enjoy Call Girls With Our Escorts
VIP Amritsar Call Girl 7001035870 Enjoy Call Girls With Our EscortsVIP Amritsar Call Girl 7001035870 Enjoy Call Girls With Our Escorts
VIP Amritsar Call Girl 7001035870 Enjoy Call Girls With Our Escorts
 
slideshare Call girls Noida Escorts 9999965857 henakhan
slideshare Call girls Noida Escorts 9999965857 henakhanslideshare Call girls Noida Escorts 9999965857 henakhan
slideshare Call girls Noida Escorts 9999965857 henakhan
 
Call Girls 🫤 Nehru Place ➡️ 9999965857 ➡️ Delhi 🫦 Russian Escorts FULL ENJOY
Call Girls 🫤 Nehru Place ➡️ 9999965857  ➡️ Delhi 🫦  Russian Escorts FULL ENJOYCall Girls 🫤 Nehru Place ➡️ 9999965857  ➡️ Delhi 🫦  Russian Escorts FULL ENJOY
Call Girls 🫤 Nehru Place ➡️ 9999965857 ➡️ Delhi 🫦 Russian Escorts FULL ENJOY
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Shamshabad high-profile Call ...
VIP 7001035870 Find & Meet Hyderabad Call Girls Shamshabad high-profile Call ...VIP 7001035870 Find & Meet Hyderabad Call Girls Shamshabad high-profile Call ...
VIP 7001035870 Find & Meet Hyderabad Call Girls Shamshabad high-profile Call ...
 
Corporate Presentation Probe May 2024.pdf
Corporate Presentation Probe May 2024.pdfCorporate Presentation Probe May 2024.pdf
Corporate Presentation Probe May 2024.pdf
 
Teck Investor Presentation, April 24, 2024
Teck Investor Presentation, April 24, 2024Teck Investor Presentation, April 24, 2024
Teck Investor Presentation, April 24, 2024
 
《加州大学圣克鲁兹分校学位证书复制》Q微信741003700美国学历疑难问题指南|挂科被加州大学圣克鲁兹分校劝退没有毕业证怎么办?《UCSC毕业证购买|加...
《加州大学圣克鲁兹分校学位证书复制》Q微信741003700美国学历疑难问题指南|挂科被加州大学圣克鲁兹分校劝退没有毕业证怎么办?《UCSC毕业证购买|加...《加州大学圣克鲁兹分校学位证书复制》Q微信741003700美国学历疑难问题指南|挂科被加州大学圣克鲁兹分校劝退没有毕业证怎么办?《UCSC毕业证购买|加...
《加州大学圣克鲁兹分校学位证书复制》Q微信741003700美国学历疑难问题指南|挂科被加州大学圣克鲁兹分校劝退没有毕业证怎么办?《UCSC毕业证购买|加...
 
Rohini Sector 17 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 17 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 17 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 17 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Sustainability Leadership, April 26 2024
Sustainability Leadership, April 26 2024Sustainability Leadership, April 26 2024
Sustainability Leadership, April 26 2024
 
Preet Vihar (Delhi) 9953330565 Escorts, Call Girls Services
Preet Vihar (Delhi) 9953330565 Escorts, Call Girls ServicesPreet Vihar (Delhi) 9953330565 Escorts, Call Girls Services
Preet Vihar (Delhi) 9953330565 Escorts, Call Girls Services
 
Call Girl Kolkata Sia 🤌 8250192130 🚀 Vip Call Girls Kolkata
Call Girl Kolkata Sia 🤌  8250192130 🚀 Vip Call Girls KolkataCall Girl Kolkata Sia 🤌  8250192130 🚀 Vip Call Girls Kolkata
Call Girl Kolkata Sia 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Russian Call Girls Kolkata Amaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Amaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls Kolkata Amaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Amaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Abids high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls Abids high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls Abids high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls Abids high-profile Call Girl
 

EN Intro to Recursion by Slidesgo.pptx

  • 2. What is recursion? Throughout your computer science journey so far, you’ve most likely heard of iteration and multiple iteration, which is repeating a particular block of code for a certain amount of times until you stop These are represented as FOR loops and WHILE loops But iteration may not be the only way to solve certain problems, and there may even be a better way An alternative way for programming problem solving is called recursion
  • 3. What is recursion? Recursion happens when a function calls ITSELF. This can be a strange concept for you to wrap your head around. But it CAN be done We will be building a recursive function to return the factorial of a number. A factorial is the product of a number and all the positive integers that are smaller than it (For all intents and purposes, this will be in pseudocode so you can use any language you want for your examples) We will call this function factorial (int number) Recursion Recursion Recursion Recursion Recursion Recursion Recursion Recursion
  • 4. What is recursion? The factorial function takes in ONE parameter and that’s the number we are trying to find the factorial of. Let’s assume that no-one will input a number less than 1 There are 2 parts to a recursive function: The first is the base case, which is critical for getting our recursive function to EXIT if(number == 1){ return 1; } We already know that the factorial of 1 is 1, so we can say:
  • 5. What is recursion? We can write the recursive step as: return number * factorial(number – 1). Our completed function is: int factorial (int number) { if number == 1 return 1 return number * factorial(number – 1); } The next part is the recursive step. This is where we get the function to call itself. What do we know about factorials? That the factorial of a number CAN be equal to the number itself [multiplied by] the factorial of the previous number
  • 6. What is recursion? Now let’s put a number into this function as an example and see how we do, and see how recursive functions operate Factorial (4) 4 · Factorial (3) = 3 · Factorial (2) 2 · Factorial (1) Let’s try 4: Every time we call the recursive function, it gets pushed to the top of the stack until we hit a base case (number = 1). Then that value gets returned and all the recursive calls get popped off the stack one by one. 4 * 3 * 2 * 1 = 24, which IS 4! This was a small intro to recursion!
  • 7. CREDITS: This presentation template was created by Slidesgo, and includes icons by Flaticon, infographics & images by Freepik and contents by Swetha Tandri Thanks Do you have any questions? youremail@freepik.com +91 620 421 838 yourwebsite.com Please keep this slide for attribution
  • 8. Alternative resources Here’s an assortment of alternative resources whose style fits that of this template: Vectors ● Desktop and smartphone app development
  • 9. Resources Did you like the resources on this template? Get them on our other websites. Vectors ● Flat cms concept in blue shades
  • 10. Instructions for use If you have a free account, in order to use this template, you must credit Slidesgo by keeping the Thanks slide. Please refer to the next slide to read the instructions for premium users. As a Free user, you are allowed to: ● Modify this template. ● Use it for both personal and commercial projects. You are not allowed to: ● Sublicense, sell or rent any of Slidesgo Content (or a modified version of Slidesgo Content). ● Distribute Slidesgo Content unless it has been expressly authorized by Slidesgo. ● Include Slidesgo Content in an online or offline database or file. ● Offer Slidesgo templates (or modified versions of Slidesgo templates) for download. ● Acquire the copyright of Slidesgo Content. For more information about editing slides, please read our FAQs or visit our blog: https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
  • 11. As a Premium user, you can use this template without attributing Slidesgo or keeping the Thanks slide. You are allowed to: ● Modify this template. ● Use it for both personal and commercial purposes. ● Hide or delete the “Thanks” slide and the mention to Slidesgo in the credits. ● Share this template in an editable format with people who are not part of your team. You are not allowed to: ● Sublicense, sell or rent this Slidesgo Template (or a modified version of this Slidesgo Template). ● Distribute this Slidesgo Template (or a modified version of this Slidesgo Template) or include it in a database or in any other product or service that offers downloadable images, icons or presentations that may be subject to distribution or resale. ● Use any of the elements that are part of this Slidesgo Template in an isolated and separated way from this Template. ● Register any of the elements that are part of this template as a trademark or logo, or register it as a work in an intellectual property registry or similar. For more information about editing slides, please read our FAQs or visit our blog: https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school Instructions for use (premium users)
  • 12. This presentation has been made using the following fonts: Alata (https://fonts.google.com/specimen/Alata) Archivo (https://fonts.google.com/specimen/Archivo) Fonts & colors used #041e52 #ffffff #073899 #4f7bc8 #80b2f1 #f4f6f8 #dbe8f1
  • 13. Create your Story with our illustrated concepts. Choose the style you like the most, edit its colors, pick the background and layers you want to show and bring them to life with the animator panel! It will boost your presentation. Check out how it works. Storyset Pana Amico Bro Rafiki Cuate
  • 14. You can easily resize these resources without losing quality. To change the color, just ungroup the resource and click on the object you want to change. Then, click on the paint bucket and select the color you want. Group the resource again when you’re done. You can also look for more infographics on Slidesgo. Use our editable graphic resources...
  • 15.
  • 16.
  • 17. JANUARY FEBRUARY MARCH APRIL MAY JUNE PHASE 1 PHASE 2 Task 1 Task 2 Task 1 Task 2 JANUARY FEBRUARY MARCH APRIL PHASE 1 Task 1 Task 2
  • 18.
  • 19.
  • 20. You can resize these icons without losing quality. You can change the stroke and fill color; just select the icon and click on the paint bucket/pen. In Google Slides, you can also use Flaticon’s extension, allowing you to customize and add even more icons. ...and our sets of editable icons
  • 23. Help & Support Icons Avatar Icons
  • 24. Creative Process Icons Performing Arts Icons