title
Re 2. Problems on Recursion | Strivers A2Z DSA Course

description
Check our Website: https://www.takeuforward.org/ Notes: Understand recursion by printing something N times: https://takeuforward.org/recursion/introduction-to-recursion-understand-recursion-by-printing-something-n-times/ Print name N times using recursion: https://takeuforward.org/recursion/print-name-n-times-using-recursion/ Print 1 to N using recursion: https://takeuforward.org/recursion/print-1-to-n-using-recursion/ Print N to 1 using recursion: https://takeuforward.org/recursion/print-n-to-1-using-recursion/ Sum of first N numbers: https://takeuforward.org/data-structure/sum-of-first-n-natural-numbers/ Factorial of N numbers: https://takeuforward.org/data-structure/factorial-of-a-number-iterative-and-recursive/ Reverse an array: https://takeuforward.org/data-structure/reverse-a-given-array/ Check if a string is palindrome or not: https://takeuforward.org/data-structure/check-if-the-given-string-is-palindrome-or-not/ Fibonacci Number: https://takeuforward.org/arrays/print-fibonacci-series-up-to-nth-term/ In case you are thinking to buy courses, please check below: Link to get 20% additional Discount at Coding Ninjas: https://bit.ly/3wE5aHx Code "takeuforward" for 15% off at GFG: https://practice.geeksforgeeks.org/courses Code "takeuforward" for 20% off on sys-design: https://get.interviewready.io?_aff=takeuforward Crypto, I use the Wazirx app: https://wazirx.com/invite/xexnpc4u Take 750 rs free Amazon Stock from me: https://indmoney.onelink.me/RmHC/idjex744 Earn 100 rs by making a Grow Account for investing: https://app.groww.in/v3cO/8hu879t0 Linkedin/Instagram/Telegram: https://linktr.ee/takeUforward ---------------------------------------------------------------------------------------------------------------------------------------------------- Check Codestudio: https://bit.ly/3G61sZZ Please check out the entire channel for other sets of series on tougher and complex topics. Also do consider subscribing :) Please check out the SDE sheet which the entire country is using and getting placed at top-notch companies: https://takeuforward.org/interviews/strivers-sde-sheet-top-coding-interview-problems/ Checkout Striver's Handles: https://linktr.ee/takeUforward

detail
{'title': 'Re 2. Problems on Recursion | Strivers A2Z DSA Course', 'heatmap': [{'end': 720.36, 'start': 687.828, 'weight': 0.924}, {'end': 888.25, 'start': 873.901, 'weight': 0.782}, {'end': 1114.792, 'start': 1083.493, 'weight': 0.713}, {'end': 1258.095, 'start': 1217.459, 'weight': 0.728}], 'summary': "Covers code studio's interview preparation resources, basic recursion problems, execution flow of recursive functions, time and space complexity analysis, and backtracking for recursive functions, offering practical examples and insights for effective learning.", 'chapters': [{'end': 66.894, 'segs': [{'end': 66.894, 'src': 'embed', 'start': 0.109, 'weight': 0, 'content': [{'end': 4.232, 'text': "so, before starting this video, i'd love to thank the sponsor of this video, which is code studio.", 'start': 0.109, 'duration': 4.123}, {'end': 5.753, 'text': 'now, if you are willing to practice.', 'start': 4.232, 'duration': 1.521}, {'end': 6.753, 'text': 'uh, interview problems.', 'start': 5.753, 'duration': 1}, {'end': 9.315, 'text': 'topic wise, this is the place where you should look for,', 'start': 6.753, 'duration': 2.562}, {'end': 16.219, 'text': 'because code studio has over 2000 plus problems and has all the problem solution in c plus plus, java as well as python.', 'start': 9.315, 'duration': 6.904}, {'end': 22.543, 'text': "if you're looking for a guided path, then you can find for python, for dbms, for object oriented programming operating system,", 'start': 16.219, 'duration': 6.324}, {'end': 26.546, 'text': "computer networks system design, web development, any other thing that you're looking for.", 'start': 22.543, 'duration': 4.003}, {'end': 29.288, 'text': "you'll find guided paths for every other thing over here.", 'start': 26.546, 'duration': 2.742}, {'end': 36.473, 'text': "also. also, if you're looking for any top company questions, let's say, if you have an interview at amazon, if you're looking for amazon questions,", 'start': 29.668, 'duration': 6.805}, {'end': 42.898, 'text': 'you can get all the top amazon coding questions via tag and all the solutions in c plus plus, java as well as python.', 'start': 36.473, 'duration': 6.425}, {'end': 46.321, 'text': 'also, if you have an interview schedule, you can read their interview experiences,', 'start': 42.898, 'duration': 3.423}, {'end': 52.786, 'text': 'where there are 600 plus interview experiences from companies like amazon, microsoft, adobe, google, etc.', 'start': 46.321, 'duration': 6.465}, {'end': 53.607, 'text': 'so what are you waiting for?', 'start': 52.786, 'duration': 0.821}, {'end': 56.269, 'text': 'code studio has a lot of free resources for interview preparation.', 'start': 53.607, 'duration': 2.662}, {'end': 57.81, 'text': 'the link will be in the description.', 'start': 56.269, 'duration': 1.541}, {'end': 58.531, 'text': 'make sure you check it out.', 'start': 57.81, 'duration': 0.721}, {'end': 65.251, 'text': 'Hey, everyone, welcome back to the channel.', 'start': 63.971, 'duration': 1.28}, {'end': 66.894, 'text': 'I hope you guys are doing extremely well.', 'start': 65.312, 'duration': 1.582}], 'summary': 'Code studio offers 2000+ problems and solutions in c++, java, and python for interview preparation, with 600+ interview experiences from top companies like amazon, microsoft, adobe, and google.', 'duration': 66.785, 'max_score': 0.109, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA109.jpg'}], 'start': 0.109, 'title': 'Code studio interview preparation', 'summary': 'Introduces code studio, a platform with 2000+ problems, guided paths for various topics, and 600+ interview experiences from top companies like amazon, microsoft, adobe, and google, offering free resources for interview preparation.', 'chapters': [{'end': 66.894, 'start': 0.109, 'title': 'Code studio interview preparation', 'summary': 'Introduces code studio as a platform with over 2000+ problems, guided paths for various topics, top company coding questions, and 600+ interview experiences from companies like amazon, microsoft, adobe, google, etc., providing free resources for interview preparation.', 'duration': 66.785, 'highlights': ['Code Studio offers over 2000+ problems for interview practice in C++, Java, and Python.', 'Guided paths are available for various topics including Python, DBMS, object-oriented programming, operating system, computer networks, system design, and web development.', 'Provides top company coding questions, including those from Amazon, along with solutions in C++, Java, and Python.', 'Hosts 600+ interview experiences from companies like Amazon, Microsoft, Adobe, Google, etc.', 'Code Studio provides a lot of free resources for interview preparation.']}], 'duration': 66.785, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA109.jpg', 'highlights': ['Code Studio offers over 2000+ problems for interview practice in C++, Java, and Python.', 'Guided paths are available for various topics including Python, DBMS, object-oriented programming, operating system, computer networks, system design, and web development.', 'Provides top company coding questions, including those from Amazon, along with solutions in C++, Java, and Python.', 'Hosts 600+ interview experiences from companies like Amazon, Microsoft, Adobe, Google, etc.', 'Code Studio provides a lot of free resources for interview preparation.']}, {'end': 258.889, 'segs': [{'end': 231.673, 'src': 'embed', 'start': 67.355, 'weight': 0, 'content': [{'end': 73.601, 'text': 'So today will be the lecture 2 of recursion playlist which is basic recursion problems.', 'start': 67.355, 'duration': 6.246}, {'end': 78.967, 'text': 'Now, in the previous video we did learn about recursion in depth what is like.', 'start': 74.142, 'duration': 4.825}, {'end': 83.872, 'text': 'so please make sure you watch out the previous video and after that only you start this video.', 'start': 78.967, 'duration': 4.905}, {'end': 90.802, 'text': 'so in this video we are going to solve, uh, some problems, the first one being, uh, print name uh five times.', 'start': 84.292, 'duration': 6.51}, {'end': 92.905, 'text': "i'm assuming you can do that.", 'start': 90.802, 'duration': 2.103}, {'end': 96.49, 'text': 'print uh linearly from one to one using recursion.', 'start': 92.905, 'duration': 3.585}, {'end': 99.174, 'text': 'definitely, print linearly from n to one.', 'start': 96.49, 'duration': 2.684}, {'end': 104.584, 'text': 'Then print linearly from 1 to n, but in some backtracking.', 'start': 100.083, 'duration': 4.501}, {'end': 109.686, 'text': "Over here, I'll teach you how can you do stuffs using backtrack, kind of backtrack.", 'start': 104.904, 'duration': 4.782}, {'end': 114.167, 'text': 'And print from n to 1, again using backtracking.', 'start': 110.426, 'duration': 3.741}, {'end': 118.448, 'text': "Okay, so I'm assuming you can do the first three.", 'start': 114.627, 'duration': 3.821}, {'end': 125.856, 'text': "But still I'll recommend you to watch the entire video because the concepts gets more clear the more you watch the videos.", 'start': 119.232, 'duration': 6.624}, {'end': 128.198, 'text': "So let's take the first problem and do it.", 'start': 126.216, 'duration': 1.982}, {'end': 130.878, 'text': 'That is a print name.', 'start': 128.678, 'duration': 2.2}, {'end': 132.5, 'text': 'End times.', 'start': 132.02, 'duration': 0.48}, {'end': 133.901, 'text': "Let's keep it end times.", 'start': 132.72, 'duration': 1.181}, {'end': 134.922, 'text': 'Okay So.', 'start': 134.061, 'duration': 0.861}, {'end': 142.921, 'text': 'The generic way is definitely to run a for loop and print the name n times.', 'start': 136.957, 'duration': 5.964}, {'end': 147.425, 'text': 'But I want you to print your name n times using recursion.', 'start': 143.482, 'duration': 3.943}, {'end': 148.926, 'text': "Yes, that's a catch here.", 'start': 147.625, 'duration': 1.301}, {'end': 150.227, 'text': 'Using recursion.', 'start': 149.466, 'duration': 0.761}, {'end': 157.932, 'text': 'So how can you do this? You know there will definitely be a main which will be calling print.', 'start': 151.227, 'duration': 6.705}, {'end': 160.394, 'text': "Okay So I'm saying n times.", 'start': 158.753, 'duration': 1.641}, {'end': 163.316, 'text': 'So what you can do is you can take the n from the user.', 'start': 160.954, 'duration': 2.362}, {'end': 165.818, 'text': 'Yes, you can take the n from the user.', 'start': 164.317, 'duration': 1.501}, {'end': 180.201, 'text': 'So input as n in Java, it will be integer.parse and, and then you can see a function with probably zero and n.', 'start': 167.475, 'duration': 12.726}, {'end': 185.263, 'text': "So over here, I'm going to teach you something, which is very important, one and n.", 'start': 180.201, 'duration': 5.062}, {'end': 187.804, 'text': "So this is the first time and I'm saying till n you print it.", 'start': 185.263, 'duration': 2.541}, {'end': 192.352, 'text': "Over here, I'm going to teach you something, change of parameters, which is very important.", 'start': 188.729, 'duration': 3.623}, {'end': 196.154, 'text': "So, I'm writing a void f, okay, no global variables this time.", 'start': 192.792, 'duration': 3.362}, {'end': 201.238, 'text': "I'm taking an integer i and I'm taking an integer n, okay.", 'start': 196.715, 'duration': 4.523}, {'end': 203.94, 'text': 'Over here, I know the base cases.', 'start': 201.839, 'duration': 2.101}, {'end': 210.465, 'text': "If I start from, yes, if I start from 1, I have to go till n, that's for sure.", 'start': 204.781, 'duration': 5.684}, {'end': 213.722, 'text': 'i have to print it n times.', 'start': 211.741, 'duration': 1.981}, {'end': 219.065, 'text': "so i know the base case is definitely going to be till i haven't printed n times.", 'start': 213.722, 'duration': 5.343}, {'end': 227.951, 'text': "so if at any moment i exceeds n, i'm going to say return because i'm going to just print it n times.", 'start': 219.065, 'duration': 8.886}, {'end': 229.532, 'text': "that's very simple.", 'start': 227.951, 'duration': 1.581}, {'end': 231.673, 'text': "coming from the previous class, it's very, very simple.", 'start': 229.532, 'duration': 2.141}], 'summary': 'Lecture 2 covers basic recursion problems including printing name n times using recursion.', 'duration': 164.318, 'max_score': 67.355, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA67355.jpg'}], 'start': 67.355, 'title': 'Recursion concepts and basic problems', 'summary': 'Covers basic recursion problems emphasizing the importance of understanding the concepts for effective learning and explains the concept of recursion and base cases in a programming context with a focus on printing a value n times.', 'chapters': [{'end': 180.201, 'start': 67.355, 'title': 'Recursion lecture 2: basic problems', 'summary': 'Covers basic recursion problems, including printing a name multiple times using recursion and linear printing with backtracking, emphasizing the importance of understanding the concepts for effective learning.', 'duration': 112.846, 'highlights': ['The chapter covers basic recursion problems The video focuses on solving basic problems related to recursion.', "Printing a name multiple times using recursion The challenge involves printing a given name 'n' times using recursion instead of a traditional for loop.", 'Linear printing with backtracking Teaching how to print linearly from 1 to n and n to 1 using backtracking.', 'Emphasizes the importance of understanding the concepts for effective learning Recommends watching the entire video to ensure better understanding of the concepts.']}, {'end': 258.889, 'start': 180.201, 'title': 'Recursion and base cases', 'summary': 'Covers the concept of recursion and base cases in a programming context, emphasizing the importance of defining base cases and explaining the recursive process through an example, with a focus on printing a value n times.', 'duration': 78.688, 'highlights': ['The base case is determined by the problem statement, and in this case, it is when the integer i exceeds the value of n, at which point the function should return, emphasizing the importance of defining base cases.', "The concept of recursion is illustrated through the example of a function that takes in parameters i and n, and prints a specified value (in this case, 'raj') n times, providing a practical demonstration of recursion in a programming context.", 'The function demonstrates the importance of not using global variables, emphasizing the benefits of avoiding global variables in programming practices.']}], 'duration': 191.534, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA67355.jpg', 'highlights': ['The chapter covers basic recursion problems The video focuses on solving basic problems related to recursion.', "Printing a name multiple times using recursion The challenge involves printing a given name 'n' times using recursion instead of a traditional for loop.", 'Emphasizes the importance of understanding the concepts for effective learning Recommends watching the entire video to ensure better understanding of the concepts.', 'The base case is determined by the problem statement, and in this case, it is when the integer i exceeds the value of n, at which point the function should return, emphasizing the importance of defining base cases.', "The concept of recursion is illustrated through the example of a function that takes in parameters i and n, and prints a specified value (in this case, 'raj') n times, providing a practical demonstration of recursion in a programming context.", 'The function demonstrates the importance of not using global variables, emphasizing the benefits of avoiding global variables in programming practices.', 'Linear printing with backtracking Teaching how to print linearly from 1 to n and n to 1 using backtracking.']}, {'end': 519.977, 'segs': [{'end': 376.542, 'src': 'embed', 'start': 287.456, 'weight': 3, 'content': [{'end': 294.998, 'text': "So, this guy calls this particular guy with i's value as 1, n's value as 3.", 'start': 287.456, 'duration': 7.542}, {'end': 302.079, 'text': 'So, the function call, yes, the first function call that you make is of f of 1, 3.', 'start': 294.998, 'duration': 7.081}, {'end': 304.14, 'text': "That's the first function call you made.", 'start': 302.08, 'duration': 2.06}, {'end': 310.97, 'text': 'Is the base case true? No, because 1 is not greater than 3.', 'start': 305.181, 'duration': 5.789}, {'end': 313.032, 'text': '1 is not greater than 3.', 'start': 310.97, 'duration': 2.062}, {'end': 316.356, 'text': 'No Thereby, you say print Raj.', 'start': 313.032, 'duration': 3.324}, {'end': 318.858, 'text': 'So, Raj gets printed.', 'start': 316.936, 'duration': 1.922}, {'end': 322.963, 'text': 'Okay Next, you are saying function of i plus 1.', 'start': 319.539, 'duration': 3.424}, {'end': 326.246, 'text': 'So, this guy calls a function with i plus 1.', 'start': 322.963, 'duration': 3.283}, {'end': 327.988, 'text': 'i was 1 over here.', 'start': 326.246, 'duration': 1.742}, {'end': 332.453, 'text': 'i gets incremented by 1 and calls the function by 3.', 'start': 328.309, 'duration': 4.144}, {'end': 341.6, 'text': "2 and n is still 3 and over here you write the same line of code i greater than n, because it's the same function which is being called.", 'start': 332.453, 'duration': 9.147}, {'end': 343.942, 'text': "so in memory it's the same one.", 'start': 341.6, 'duration': 2.342}, {'end': 349.186, 'text': 'print raj and then f of i plus 1, comma n.', 'start': 343.942, 'duration': 5.244}, {'end': 356.291, 'text': "okay, this time, let's understand, if this base case is executed, i is 2, n is 3.", 'start': 349.186, 'duration': 7.105}, {'end': 358.533, 'text': 'so this will not be executed.', 'start': 356.291, 'duration': 2.242}, {'end': 359.874, 'text': 'print raj.', 'start': 358.533, 'duration': 1.341}, {'end': 360.595, 'text': 'again you print raj.', 'start': 359.874, 'duration': 0.721}, {'end': 366.599, 'text': 'right. remember this function of one of three called this f of two, three.', 'start': 361.957, 'duration': 4.642}, {'end': 370.06, 'text': 'so in recursion tree it will be f of two, comma three.', 'start': 366.599, 'duration': 3.461}, {'end': 372.441, 'text': 'this is how you create the recursion tree.', 'start': 370.06, 'duration': 2.381}, {'end': 373.541, 'text': 'now f of two, three.', 'start': 372.441, 'duration': 1.1}, {'end': 376.542, 'text': 'this is printed and now this portion.', 'start': 373.541, 'duration': 3.001}], 'summary': 'The transcript explains a function call with specific values and its recursion tree.', 'duration': 89.086, 'max_score': 287.456, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA287456.jpg'}, {'end': 495.877, 'src': 'embed', 'start': 468.879, 'weight': 0, 'content': [{'end': 472.681, 'text': 'you can definitely return back to where it was called.', 'start': 468.879, 'duration': 3.802}, {'end': 475.823, 'text': 'and now the function, the program, terminates.', 'start': 472.681, 'duration': 3.142}, {'end': 484.083, 'text': 'so this is how easily the recursion did work, and we did it in the parameters and not using any global variables.', 'start': 475.823, 'duration': 8.26}, {'end': 487.647, 'text': 'So I was able to print my name n number of times.', 'start': 484.443, 'duration': 3.204}, {'end': 492.354, 'text': 'Yes, I was able to print my name n number of times and at f of 4, 3, I returned.', 'start': 487.668, 'duration': 4.686}, {'end': 494.115, 'text': 'so this got completed.', 'start': 492.794, 'duration': 1.321}, {'end': 494.796, 'text': 'this return.', 'start': 494.115, 'duration': 0.681}, {'end': 495.877, 'text': 'so this got completed.', 'start': 494.796, 'duration': 1.081}], 'summary': 'Recursion successfully printed name n times without global variables.', 'duration': 26.998, 'max_score': 468.879, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA468879.jpg'}], 'start': 258.889, 'title': 'Recursion concepts', 'summary': 'Explains the flow and execution of recursive functions using examples, demonstrating the process with values, base case evaluation, function call sequence, recursion tree creation, and successful termination of programs, achieving the desired output.', 'chapters': [{'end': 349.186, 'start': 258.889, 'title': 'Recursion flow explanation', 'summary': 'Explains the flow of a recursive function and function calls, with the example of a function f(i, n) and demonstrates the process using the values i=1 and n=3, showcasing the base case evaluation and function call sequence.', 'duration': 90.297, 'highlights': ['The function is demonstrated with the values i=1 and n=3, showcasing the base case evaluation and function call sequence.', 'The explanation includes the function calls f(1, 3) and f(2, 3) and the corresponding base case evaluation for each call.', "The process demonstrates the incremental change in the value of 'i', with i initially being 1 and then incremented to 2 for the subsequent function call."]}, {'end': 468.879, 'start': 349.186, 'title': 'Understanding recursion tree', 'summary': "Explains the execution of a recursive function f(i, n) with a base case i=2, n=3, leading to the creation of a recursion tree and the subsequent execution of function calls, resulting in the printing of 'raj' multiple times.", 'duration': 119.693, 'highlights': ["The function f(2,3) leads to the creation of a recursion tree with subsequent function calls, resulting in the printing of 'raj' multiple times. The function f(2,3) initiates a recursion tree with subsequent calls such as f(2,3) calling f(3,3) and f(3,3) calling f(4,3), resulting in the printing of 'raj' multiple times.", 'The base case i=2 and n=3 leads to specific function calls and the eventual termination of function execution. The base case i=2 and n=3 leads to specific function calls such as f(2,3) and f(3,3), eventually leading to the termination of function execution.', 'The condition i>n determines the termination of function execution. The condition i>n acts as a determinant for the termination of function execution, leading to the return of function calls and the subsequent termination of the function.']}, {'end': 519.977, 'start': 468.879, 'title': 'Recursion example: print name n times', 'summary': "Demonstrates a recursive function to print a given name 'n' number of times, achieving this without using global variables and successfully terminating the program. the function was able to print the name 'n' number of times and successfully returned at specific function calls.", 'duration': 51.098, 'highlights': ["The function demonstrates recursion to print a given name 'n' number of times without using global variables.", 'The program successfully terminates after the recursive function call.', "The function was able to print the name 'n' number of times.", 'The program returned at specific function calls: f(4) and f(3).', 'The base condition was hit, and the program successfully returned.']}], 'duration': 261.088, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA258889.jpg', 'highlights': ["The function demonstrates recursion to print a given name 'n' number of times without using global variables.", 'The program successfully terminates after the recursive function call.', 'The base condition was hit, and the program successfully returned.', 'The explanation includes the function calls f(1, 3) and f(2, 3) and the corresponding base case evaluation for each call.', 'The condition i>n acts as a determinant for the termination of function execution, leading to the return of function calls and the subsequent termination of the function.', "The function was able to print the name 'n' number of times.", 'The base case i=2 and n=3 leads to specific function calls such as f(2,3) and f(3,3), eventually leading to the termination of function execution.', "The process demonstrates the incremental change in the value of 'i', with i initially being 1 and then incremented to 2 for the subsequent function call.", "The function f(2,3) leads to the creation of a recursion tree with subsequent function calls, resulting in the printing of 'raj' multiple times."]}, {'end': 836.597, 'segs': [{'end': 547.244, 'src': 'embed', 'start': 519.977, 'weight': 0, 'content': [{'end': 525.895, 'text': "so If I talk about the time complexity, space complexity, it's very, very simple.", 'start': 519.977, 'duration': 5.918}, {'end': 537.48, 'text': 'I can say the time complexity to be b go of n, because inside the functions, yes, inside the functions these lines are like b go of one,', 'start': 526.515, 'duration': 10.965}, {'end': 538.56, 'text': "like they don't take any time.", 'start': 537.48, 'duration': 1.08}, {'end': 545.223, 'text': "So apparently you're calling one function, that guy calls one more function, that guy calls one more function.", 'start': 538.981, 'duration': 6.242}, {'end': 547.244, 'text': "So you're calling n functions.", 'start': 545.644, 'duration': 1.6}], 'summary': 'The time complexity is o(n) as n functions are called.', 'duration': 27.267, 'max_score': 519.977, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA519977.jpg'}, {'end': 617.943, 'src': 'embed', 'start': 568.709, 'weight': 1, 'content': [{'end': 576.092, 'text': 'when you called, f would have been in the stack, then f would have been in the stack, then f would have been in the stack.', 'start': 568.709, 'duration': 7.383}, {'end': 580.514, 'text': 'So, they were waiting in the stack till this base case returned.', 'start': 576.333, 'duration': 4.181}, {'end': 582.595, 'text': 'They were waiting to be completed.', 'start': 580.855, 'duration': 1.74}, {'end': 591.119, 'text': "So, thereby, I can say the space complexity is also big O Now, this space complexity is hypothetical, like you're not using an array.", 'start': 582.976, 'duration': 8.143}, {'end': 596.982, 'text': "Internal, the computer's internal memory uses the stack space.", 'start': 591.599, 'duration': 5.383}, {'end': 603.269, 'text': 'So thereby making the time complexity and the space complexity to be big O of n and big O of n.', 'start': 597.483, 'duration': 5.786}, {'end': 604.65, 'text': 'I hope that makes sense.', 'start': 603.269, 'duration': 1.381}, {'end': 611.777, 'text': 'So guys we have done the first problem which is print the name n times or 5 times.', 'start': 607.052, 'duration': 4.725}, {'end': 617.943, 'text': "Now let's do the next problem which is print linearly from 1 to n.", 'start': 612.978, 'duration': 4.965}], 'summary': 'The space complexity is big o of n, and the time complexity is big o of n. the first problem involved printing a name n times or 5 times, and the next problem is to print linearly from 1 to n.', 'duration': 49.234, 'max_score': 568.709, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA568709.jpg'}, {'end': 720.36, 'src': 'heatmap', 'start': 687.828, 'weight': 3, 'content': [{'end': 690.869, 'text': 'Similarly, you can just go on printing till whatever your n is.', 'start': 687.828, 'duration': 3.041}, {'end': 698.134, 'text': 'So, it is quite similar to the previous one where I am easily able to print 1 to n.', 'start': 691.23, 'duration': 6.904}, {'end': 706.74, 'text': 'Correct? Now, it is a time to think it in the reverse order and do the next problem which is print in the opposite fashion.', 'start': 698.134, 'duration': 8.606}, {'end': 714.218, 'text': 'Print in terms of n to 1.', 'start': 707, 'duration': 7.218}, {'end': 720.36, 'text': "So, like, if I give you n equal to 4, you're going to print me 4, 3, 2, 1.", 'start': 714.218, 'duration': 6.142}], 'summary': 'Printing numbers in reverse order from n to 1.', 'duration': 32.532, 'max_score': 687.828, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA687828.jpg'}], 'start': 519.977, 'title': 'Time and space complexity analysis and printing numbers', 'summary': 'Discusses time complexity as o(n) and space complexity as o(n) due to recursive function calls. it also covers functions to print numbers in linear and reverse order, demonstrating the use of recursion with a time and space complexity of o(n).', 'chapters': [{'end': 591.119, 'start': 519.977, 'title': 'Time and space complexity analysis', 'summary': 'Discusses the time complexity to be o(n) and the space complexity to be o(n) due to the recursive function calls, each taking up stack space.', 'duration': 71.142, 'highlights': ['The time complexity is O(n) as there are n function calls, with each function calling one more function, resulting in a total of n functions.', 'The space complexity is also O(n) as each function call is waiting in the stack till the base case is returned, leading to a hypothetical stack space usage.']}, {'end': 836.597, 'start': 591.599, 'title': 'Printing numbers in linear and reverse order', 'summary': 'Covers the implementation of functions to print numbers from 1 to n and in reverse order, with a time complexity and space complexity of big o of n, demonstrating the use of recursion.', 'duration': 244.998, 'highlights': ['The time complexity and the space complexity for printing numbers linearly and in reverse order are big O of n.', 'The function to print numbers linearly starts from 1 and recursively prints numbers till n is reached, demonstrating a clear step-by-step process.', 'The function to print numbers in reverse order is implemented by starting from n and recursively printing numbers till 1 is reached, showcasing a clear step-by-step process and the use of recursion.']}], 'duration': 316.62, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA519977.jpg', 'highlights': ['The time complexity is O(n) as there are n function calls, with each function calling one more function, resulting in a total of n functions.', 'The space complexity is also O(n) as each function call is waiting in the stack till the base case is returned, leading to a hypothetical stack space usage.', 'The time complexity and the space complexity for printing numbers linearly and in reverse order are big O of n.', 'The function to print numbers linearly starts from 1 and recursively prints numbers till n is reached, demonstrating a clear step-by-step process.', 'The function to print numbers in reverse order is implemented by starting from n and recursively printing numbers till 1 is reached, showcasing a clear step-by-step process and the use of recursion.']}, {'end': 1314.979, 'segs': [{'end': 927.808, 'src': 'heatmap', 'start': 873.901, 'weight': 0, 'content': [{'end': 879.465, 'text': "What if I want to print from 1 to n, but I don't want to do i plus 1.", 'start': 873.901, 'duration': 5.564}, {'end': 884.668, 'text': 'Instead, I say that the recursion call starts from n comma n usually.', 'start': 879.465, 'duration': 5.203}, {'end': 888.25, 'text': 'Like, to give a better brief, let me just explain.', 'start': 885.088, 'duration': 3.162}, {'end': 893.533, 'text': 'I am saying print from 1 to n.', 'start': 888.27, 'duration': 5.263}, {'end': 894.233, 'text': 'Print from 1 to n.', 'start': 893.533, 'duration': 0.7}, {'end': 900.861, 'text': 'but i am not going to allow you to use plus one.', 'start': 895.618, 'duration': 5.243}, {'end': 905.183, 'text': 'like generally, from one to n was meaning f of i plus one.', 'start': 900.861, 'duration': 4.322}, {'end': 909.766, 'text': 'comma. n was the function call was the recursive function call that you are making.', 'start': 905.183, 'duration': 4.583}, {'end': 912.087, 'text': "i'm not allowing you to do that.", 'start': 909.766, 'duration': 2.321}, {'end': 915.629, 'text': "i'm not allowing you to do plus one, so how will you do this?", 'start': 912.087, 'duration': 3.542}, {'end': 918.451, 'text': "so, over here i'm going to teach you something as backtracking.", 'start': 915.629, 'duration': 2.822}, {'end': 920.272, 'text': "okay, so let's understand backtracking.", 'start': 918.451, 'duration': 1.821}, {'end': 924.908, 'text': "Since I'm not allowing you to use plus, you have to use minus.", 'start': 921.587, 'duration': 3.321}, {'end': 927.808, 'text': "So, what I'll do is i comma n, okay, as usual.", 'start': 924.948, 'duration': 2.86}], 'summary': 'Explanation of printing from 1 to n without using plus one, focusing on backtracking technique.', 'duration': 53.907, 'max_score': 873.901, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA873901.jpg'}, {'end': 1137.845, 'src': 'heatmap', 'start': 1083.493, 'weight': 1, 'content': [{'end': 1087.675, 'text': 'if this line is true, what happens?', 'start': 1083.493, 'duration': 4.182}, {'end': 1090.377, 'text': 'you basically say return, executes.', 'start': 1087.675, 'duration': 2.702}, {'end': 1091.738, 'text': 'so you return.', 'start': 1090.377, 'duration': 1.361}, {'end': 1096.46, 'text': 'so this function line has been executed correct.', 'start': 1091.738, 'duration': 4.722}, {'end': 1105.965, 'text': "now the print comes over here, because after this the line of execution comes over here and it says print i, what's the value of i one?", 'start': 1096.46, 'duration': 9.505}, {'end': 1107.906, 'text': 'so the output will be one.', 'start': 1105.965, 'duration': 1.941}, {'end': 1114.792, 'text': 'next, the execution line comes over here, which means the function has been executed correct.', 'start': 1107.906, 'duration': 6.886}, {'end': 1118.314, 'text': 'go back, went back.', 'start': 1114.792, 'duration': 3.522}, {'end': 1120.935, 'text': 'this line has been executed.', 'start': 1118.314, 'duration': 2.621}, {'end': 1124.977, 'text': 'thereby, the function line comes to the next.', 'start': 1120.935, 'duration': 4.042}, {'end': 1126.458, 'text': 'this print is i.', 'start': 1124.977, 'duration': 1.481}, {'end': 1130.941, 'text': "what's the value of i 2 printed?", 'start': 1126.458, 'duration': 4.483}, {'end': 1135.543, 'text': 'next, the line of execution goes here, which means this function has been executed.', 'start': 1130.941, 'duration': 4.602}, {'end': 1137.845, 'text': 'go back, this line.', 'start': 1135.543, 'duration': 2.302}], 'summary': 'Explanation of function execution and output values: 1, 2.', 'duration': 31.88, 'max_score': 1083.493, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA1083493.jpg'}, {'end': 1258.095, 'src': 'heatmap', 'start': 1217.459, 'weight': 0.728, 'content': [{'end': 1221.77, 'text': 'so this is how you print from one is to n.', 'start': 1217.459, 'duration': 4.311}, {'end': 1225.191, 'text': 'now i will be asking you to do the other one.', 'start': 1221.77, 'duration': 3.421}, {'end': 1226.531, 'text': "so this is what i've done.", 'start': 1225.191, 'duration': 1.34}, {'end': 1229.452, 'text': 'but my backtrack, this has been done.', 'start': 1226.531, 'duration': 2.921}, {'end': 1231.212, 'text': 'i want you to do the other way.', 'start': 1229.452, 'duration': 1.76}, {'end': 1232.933, 'text': 'i want you to print from n to n.', 'start': 1231.212, 'duration': 1.721}, {'end': 1238.358, 'text': 'basically, if i give you as n equal to 3, want you to print.', 'start': 1232.933, 'duration': 5.425}, {'end': 1242.702, 'text': "uh, three, two, one, but i don't want you to use this.", 'start': 1238.358, 'duration': 4.344}, {'end': 1243.683, 'text': 'i minus one comma.', 'start': 1242.702, 'duration': 0.981}, {'end': 1245.165, 'text': "n i don't want to do.", 'start': 1243.683, 'duration': 1.482}, {'end': 1246.987, 'text': "i don't want you to use this.", 'start': 1245.165, 'duration': 1.822}, {'end': 1249.85, 'text': "okay, so i've not solved this.", 'start': 1246.987, 'duration': 2.863}, {'end': 1252.573, 'text': 'i want you people to answer in the comment section about this.', 'start': 1249.85, 'duration': 2.723}, {'end': 1254.415, 'text': "let's see if you have understood the entire concept.", 'start': 1252.573, 'duration': 1.842}, {'end': 1255.456, 'text': 'you should be able to do it.', 'start': 1254.415, 'duration': 1.041}, {'end': 1258.095, 'text': 'yes, you should be able to do it.', 'start': 1256.414, 'duration': 1.681}], 'summary': 'Task to print a sequence from n to 1, requesting feedback from audience.', 'duration': 40.636, 'max_score': 1217.459, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA1217459.jpg'}], 'start': 836.937, 'title': 'Backtracking for recursive functions', 'summary': 'Covers backtracking for recursive functions, emphasizing replacing plus with minus in the recursion call and sequencing the print line after the function call to achieve reverse order output, illustrated with a recursion tree and 3 basic problems solved, preparing for the challenge of printing from n to 1 without using i minus 1.', 'chapters': [{'end': 1314.979, 'start': 836.937, 'title': 'Backtracking for recursive functions', 'summary': 'Covers backtracking for recursive functions, emphasizing replacing plus with minus in the recursion call and sequencing the print line after the function call to achieve reverse order output, illustrated with a recursion tree and 3 basic problems solved, preparing for the challenge of printing from n to 1 without using i minus 1.', 'duration': 478.042, 'highlights': ['The chapter covers backtracking for recursive functions and emphasizes replacing plus with minus in the recursion call. Emphasizes the concept of replacing plus with minus in the recursion call, demonstrating a fundamental shift in the approach to solving problems.', 'Sequencing the print line after the function call to achieve reverse order output is explained with a recursion tree and 3 basic problems solved. Illustrates the sequencing of the print line after the function call to achieve reverse order output, supported by the visualization of a recursion tree and solving 3 basic problems.', 'Preparation for the challenge of printing from n to 1 without using i minus 1 is introduced. Introduces the challenge of printing from n to 1 without using i minus 1, signaling a shift to a more complex problem for the audience to tackle and understand.']}], 'duration': 478.042, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/un6PLygfXrA/pics/un6PLygfXrA836937.jpg', 'highlights': ['The chapter covers backtracking for recursive functions and emphasizes replacing plus with minus in the recursion call.', 'Sequencing the print line after the function call to achieve reverse order output is explained with a recursion tree and 3 basic problems solved.', 'Preparation for the challenge of printing from n to 1 without using i minus 1 is introduced.']}], 'highlights': ['Code Studio offers over 2000+ problems for interview practice in C++, Java, and Python.', 'Guided paths are available for various topics including Python, DBMS, object-oriented programming, operating system, computer networks, system design, and web development.', 'Provides top company coding questions, including those from Amazon, along with solutions in C++, Java, and Python.', 'Hosts 600+ interview experiences from companies like Amazon, Microsoft, Adobe, Google, etc.', 'Covers basic recursion problems and emphasizes understanding the concepts for effective learning.', 'Illustrates the concept of recursion through practical examples and the importance of not using global variables.', 'Teaches linear printing with backtracking for recursive functions.', "Demonstrates recursion to print a given name 'n' number of times without using global variables.", 'Explains the time and space complexity analysis for recursive functions.', 'Covers backtracking for recursive functions and emphasizes replacing plus with minus in the recursion call.', 'Explains sequencing the print line after the function call to achieve reverse order output and introduces preparation for the challenge of printing from n to 1 without using i minus 1.']}