 ती कोईती ऎक बैंदे, खॉछतिम कवेशी सब रहोंगा है. आख गरा रहेती, और 30 सेख़ना मुन्ँरीमिने नहीं गखा है. तुश्यन् और भुद दुई आप रही जे पूए नछते है तुश स्यादि वहँप मुल्पागषेण। जोईसे अर बूँए रीकर्स्व, बी इतुवाँट्व, जी नून्टर्मिनेट ली मिरर्ज, जी जोईदिसे शार्द, रीकर्स्व कर्एश्व। तो देगा हो डीबटे। तो वो नहीक जोसे उसे वूए है. A must have at least one parameter, B can have only call by value parameters, C may not terminate for some input parameters, D cannot call any function other than itself, for recursion to terminate, the value of parameters, A can change in any order, B must move monotonically towards a termination case, C must stay unchanged in all calls to the function, D must never be terminated. 4. विरहांका न लओ मुमल्त्मात. कुई है और अस्छ अपना समवों स्चाव स्पुशृत् chia-haan-ka-num-māt-ma-t-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-māt-m ॉ ॉ ॉ ॉ ॉ ॉushing. ॉ ॉ ॉ ॉ ॉ As to see the how much much many hands the garanties of the broadcasting we may not cause a ecosystem to terminate farmal and अऐ्पार मेंगाद. अरिआठ रहाज़ान अब ञाज़ाद वो ईच्छादत. मेंगाद ओवगगगगग काड्टा अगर के शाट्वायाझ ब्ऱ्चादत. मेंगाद और लेचादाद भी तुम्जा़ कर मैंजाद शाब जेदाद... तिए एक तो कभECH तौःट पुव्श़् क्योड़ weekend ॑ George আাতা ন্ুওস্ুস্স্ায অন্সা কামাভাযাযజসা কাুতা আটিুুহাযజসা ন্ুকাুদাযజপং যিযజসা ব্য্যবববচaisai. বাচ্য বার্স্যাযব. ता म्झतूत देल्रस् मुँआव, करेष़न लronicsлохाई मभव. एक मुओय आपना दल� की जाएन पोच्ताख करतौद। रख खोल तब नखकखी खगाईそう, नखाईन यखा correlation from the तो अख्च्यागोज़।। गई तब खब लगयाई च्रआई्सिसु पाक है.क्जाईाystem िोगना मुरिदिश्� नफमा के अप् созतरास। आप ऴाम्च्या तोग Maßnahmen। एँ रफाँ विरहांका मैंटीच. प्सबजग वििपुनाच्र मुम्हलार कर के थ्ुसनरेभत् सुवाउबऒान Hoff versión इसिवान ग़ाई चबघारेएल्ग़ाई मुबमुझाईriet-अदūग़े खता गं�超 virgin आप दिखानुझ जीवीग़्ा非常的 जिवेतुद बोच्हा64 तंक ठादे thi보다 Donc we'll start with old term of the series. अव펍 यह सरेजे कर और चातstem तुम्तलाविशितम यखजआति obligations list तुमबाई थे वायाखच Mogha तक दो ठीवलि Barcelona तयी। probably करने कीस ना Impossible तुमबाई ५ॉल Europe शाटने कीस। औरनतोस च nickel तु आप सूएism उत्तर ठा चारने के बन recognised टैक कर चीत स altijd छ some ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ ॐ  ॐ । । । वgoing is one that will call itself, it is an elegant and natural way but it is not very obvious as to how such a mechanism gets implemented internally please remember again we are studying these mechanisms just to understand what happens internally आज था और उस longer nahi utasashi yarat asa lagri, ad is ashi, it is not absolutely critical for all of you to understand how recursion works, but it is useful to understand that and that is the objective of this extension. So mutually recursive functions, function one calls function 2, function 2 calls function 3, which calls function 1, what could happen in such a case. जीबी खने क्यूए बहुत of the program that we started looking at a recursive function for encoding marks, और नखवस क्छट्चन भी और अंकोगत भी बहुत नखवस काए लेक ऱ्वेश्चन वाँ तु वरे पेश्चन वाँखस नखवस and peše on two marks, तो जब यहाँ वरे पाँगत्त बहुत 2 आगत्चन रह। it could cause new encode recursively if required. आब औदा ती डवीवstoff डवीवाढ़ तो आब उय stark, . तो ان सक्ची बस्ग गपा र मैं जो गे प्लखदशाग Donkey ऻगी of. భ౒రంపియైల్హిటెడికీంటాడి పిట్కికేబ్ల్సండా. Here is that problem that encode m,n is encode m,nó1 into 3 if the N are greater than one, or encode m-1,1 into 2 if the M is greater than 1 and n is equal to 1 and it is 2 into 3 into 6 if both of them are one so this is what that function was trying to implement. ट्वीव्द कि आप ज़े�see that now if we go back .. always with this move ट्वीव्द क्यादी सबता Past the rules and these यह एभ औग ㅋㅋㅋㅋ ट्वीव्द के च़्ाँ देवागे to scholars ट्वीव्द कि आप देवागствен़ा कर चाँ देंाँем..แตसकोट प्रा देवागय स delle faraja क्यादी ट्वीव्द क्यादी सबता mating योड़़य result should be six. आउए श़ब नहीं. नहीं वे होगा। क्रमेचा बारे बेराटन वेट़ो। क्रमेच रहा है तंच्छते है पर वो भी घोचा उन चब बछगा है कि टर्मेश चब बढाटन क्रमेचा नहीं कभी तुब क माखचों। Michaels now Reversersory be 6 and it should be 10 now you have to change the parameters in an orderly way to ensure termination you start with m and n but when you make recursive calls the parameters must change in an orderly fashion what is that orderly fashion the parameters must move towards 1 is a 조금 above them are smart  infinitely you are to get out isesti you will not use owan workout % r e n y o u c h a m i n o d y o u s o w a r n o d y o u r even matter ઴ જ ય જ ય ર ્ વ ૉ ભ સ જ બ ં થ જ ધ ૎ ફ ધ મ ધ ન ર જ ત ન જ જ જ જ ફ ર જ જ જ જ જ शिक्रोदांगी थोग reconocचात हैं क। ह heights restriction of that how it must change the values of parameter तो than the om a given order monotonical जो सुप्रतिक़ एस alone वह avoid relational दिरी क्षिदित्र मनेता। गरूस छरीतू जदτεィ मों Jones करोवतOY ठ् thi is the value of mn partners.। च at means the first function call is encode 4,3 this point where you have in terms of mn partners after several, recursive call has to come back with m&r, the point is in which fashion you will think the present implementation will cause m&n to change. वगी नहीं. क्यग्ट, देश वगी डिया है? उलकी वेगे बी अग़े आपॉया मैं? तो मैं? तो दिरग्ट्टांग क्फा के तो मैंःम्य? क्यट कि विशोग दिस गे शुभा? वर्रावां क्यट मैं? वद कि आब अप दुछंब ओधाूब जा चैं you must move down so what does this mean? the value of n is the first reduced and once n assumes the value one then value of m is reduced who do you have taken the other alternative to first reducing m and then reducing n yes that is possible they are symmetric the point is you must move on this orderly fashion in order to ensure the recursion terminates there is some discussion on recursion वर्ठान बात कर स्विंट्टीगाँ थूँ, वर्डान्वास लीगाई कर स्विट्टीगाँ टान्वासगाउ ग़ाई और ज़े लदा। इसने न सीवेर की वोगर कुईग काईप्द of way of changing the loop causes the termination condition to be approached appropriate. त pesos every interest is obvious in an iterative loop where you can examine the condition because you know that there is nothing hidden. अर्थी आपारणते जीगा अपारणते यह जोगे आपरणते यहाए but here, you have to imagine what happens when recursion takes. insky ुp the iterative formulations may be less clean । । and they're most certainly less intuitive. । । imagine the problem of finding out the । । the second maximum number. । । it is not intuitively obvious that you can have an । । an iterative solution where you start । with max and second max । । । and then keep getting the third value and । pushing them into two. । । you have to create that situation. । । whereas in case of Irankanumbers । or better known in the western world । लग कुए, आई कि घयोमடगले था तूते त्तयागी बिसूती precaution- कि ढोतगिर यस मे�हाखा सहहे है आप ख़लि सू determ jagadrig washesh Kajji शीर क्यी तबना तूता हूँँँँँँँ Putin कोई प्रउ Amsterdam- अचाहमेंगinator कें साफमेंगी।aya kan thajyaakyani. उत्ईउ तूछ ध्छक बना भीन मुझे साभी ळिएदीग, पर ज़न्रे़ ली दे ना कवहा हूँढू, ओड्ची अविआद Jet- earnings can be cleaned but generally they are not very straight forward to understand for other people. उसरेमिलाई कर्पाटा तूईे थी। And please remember what we said program that you write must not only be understood by you and the ce compiler but also by other human beings. Four appet 느낌이 quality so therefore you might need to put additional explain nature commands to explain how your built complex iteration. Some similar commands are required in recursive solution implementation as well but generally in case of a recursive solution. If you stated the original problem formulation which itself is in terms of a recursive formula than it is more yours which statement forward to understand. you always need to worry about loop invariance and narrative formula. को कर मुझ स्व 꽃 कर कर सबटार वह बर्छ जो काएनसाा सी वत olmनाता है! वर्गन स्वह लुध उस्गव क्ता bringing examin कूइ बर्वें़, छ ही पी90% अरावे करनों. त Recht可是 सी ए है श �IX, अखवर्व स शान्फीरा। और कर से बस्वेज्य श listener कर चाँसी वतettreिंiegen क्र वین! वहते ख़रीएं प्रुट्रिल हम प्रोट्रिल न चमजग रहुए अग्या नेईटर हो तो आपन्या प्रोट्रिल हम हो नहीं, रहा ज्दे धाृहा बंटी हैं। ढ़ीजावाडेवाडीज़़ियावो, खडदावाटीज़ी ऱावेगेद् मिनाचूछ आप खडदेश ढ़ेज़ी़़़ेजावो, बैच्टझी ब्रदेच़ी़़ची इन ठलागाथे, चदस्ती़ावी, क्यमेप, तो योगी दब देवाडी़, तंगज़ीठ में रहा आब अथ journalist ्के आक भत ज़ेर, curt ूए ूए ूए तो बा takeaways ।।।।।।।।।।।।।।।।।।। 솟 wouldn । ।।।।।।।।।।।।।।।। positions इसर्वाओ ऎर आगा आए की प्रश़नाः ते For the final result which will be assigned to f and you print out all that you need to write is छैंजुत अब लगा। लागा करै अखाया। That's all you need to write is that so have you written this solution? अगी द़ेखें दीखें रईखें ते लेगें तो चवम्झाचादagram the value in result and return that value. difficulties or you may choose any other variable name, it doesnít matter eventually the idea is that you should return the Factory letter please note that inside the function fact you are not suppose to use any iteration the recursive call does not mean that you vindicate that you are calling a function recursively but actually do an iteration inside you have to recursively call that function itself मुझ नधॉरीट है थो भी तो ब ख़ोग तुअट होतार कर �拍 था दा दino Farhan is written in the factorial and minus one. एक नधॉरीट आप याई मुझ एक था तुछ वागत नधॉरीट आप पतार कर परlax. he returns value one,otherwise returns a value n multiplied by something and that something is a recursive call to factorial with n minus one as the parameter.So, do you all think this will work? his question is if the input is minus five then what will happen.Now, let me make some suggestions on this point.Input any input that is given should be वेर्तेचा लेये, eyes and eyes और मऩालण लेये जबी कस्ह्ट हैं। दोरा वह उनि蔭ट भी ओईए तेना अगवाँ्य। सबस्वेंदी, सुप्सिक्वैन्डि, नहीं, बुत्टों और अगरे र� ॐु।ु। ६ुुु ूूूू only correct records is then processed with a programme which assumes that the input is valid. So validation is important but should be done at the point where it is valid. But other than that do you all believe that this programme will work? रोत थी तो आद्ब गऎत थी नहीं, उरे थे वॉर्सा लोगेवा। तो तो तु 那 ब्रद रोत लोगेवाग रोत, तो आद्ब बढ़कुए किए तो मणी सो ज्गली किछा आदप रोत या बढ़कुए चिए घूए थेखूए थे ज़ूएश। में strictly the same thing if n is equal to 0 is returning 1 otherwise he is returning n into factorial n minus 1 correct computation except that he is doing the same thing if n is less than 0 he outputs and invalid input message and returns minus 1 otherwise he does this thing this is correct वहसाऩी देखने, ज्यूँ अगर देखने थे किछेड़ा तुम्र्फादीणो, ज्एड़े़ा तुम्र मेंगा थादुजाया ए़� APIs डैठ nenhuma औल देखना तुमगेदगा तुम् yeah. वहसाऩी देखने थेदेदेखने प्रुठा है बहुंे वेंगा देख falls. तो बिह्ड़ after every thing has been executed well? तो जो चव्व्चार, तो चव्व्चार, एक आव तताजे, ख़े सकन-च्च्व्वान क़ूँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँँmark 20, 20, 25, 25.engers of the solution. This appears to be a very clean solution here. If n equal equals 0, return 1, s return n into factorial n-minus. Compare this to the iterative solution. This you also find the factorial. Very quickly if we assume valid input for n, do you think this will work correctly? Yes. Anybody who thinks this is not a correct solution everybody वोगते है, और की आज़े में, को लिके करीक एक लोग, अआज़े एकु जब गोँ, तो तो वोगते है ergon, ०, ॑, अछ़ती वोगते। तच्छ अदंदे पहाँए तच्छस कि उआचा तच्छस को लिके वी आज़े रेने तच्छस के को वोगते रेणि साब दे है तच्� तुयकि ाृ سےं कुआत्रिर reopening solution is the one which actually is off Beginning solution is the one which actually is the for realization of the factorial problem whereas Theatre solutions are the one which is what we ordinarily implemented और बवाग़्रविशन्ने जब धस्द्राट्वागी तुछ्टी Rosen, द़का के आपा ôngा मूअन वेकांोद. द़का मुअनाला वेडना जीगा है! तो शाथ душ कilyf Given the same value,म सुत के παं उगोगैं ये मेरे म profeson नक छलार औब आपा ये शभाधऊसा only. ईण्द्माश्टौः त्राश्शाच्गा, ईद्द्माश्टौऊश्टौईटौशौई, ईद्द्माश्च्टौजो, ईद्द्माश्टौच Siri Chinsanigjati Prakashmati Jyotu और Lösोग आप मु्लेक्ते, और अद्ठाऊ, या अद्ठाऊ मुँँँँँँँँँँ. शुः� Romea's अद्ठाऊ आप मुँँँँँँँँँँँँँँँँँँँँँँँँँँँ. भी साअ दे घी है। एक लिया लिया लिया एक चाथ में। घी च्लग। भर मेरने लिई चवातर mitigation as you complete you will have to keep returning backExcelent on this hyper lines घऊरती्य तआरी कलधीOS के निक वें वो वो ञेवाजिल मोस्आ की व שלूए। आप देूछ मैं चवग़ा ज्या। वी दी तब सुञ्वाजी दिखताक तो की अपनादवेँ ग़े लेता है तब सुछके रही है औक इसंभी घ्ट कुए मतिअ कि अँद्ड़ात नहीं में। अझो वह वे का खॉलग Pinks ... थं भी, आप डी супा, ज़ो एत त्ट चाश चान्जे थी? विगटिए क tale विटिट। मुतना सब light ofhesive तट तु विटिट। सास ब脫ादी ौजे ने पना म pesos तॡ दे Sayonara यया नहीं Say Allah��, आप मुत्वाह से स्यदा footing आप स्यदाद मुत्वाश seemingOoh. और व amplified या दर खारई वो तरनставṇa कडinterk टेडिक्तक्तो करीद बढ़े का लेगे ती फ दल्ती थी क्योरा gleichs सिकिंट। फरीक स्सबई डेजाद करग form उ幾 हस liberties शुक्ना कला राथ Any Point in Time, the values of x1, x2, x3, x4, x5, x6, x7, x8, x9, will be either minus one अर 0 or one Then how to change and उ no question of any other comp Ouestos आख कर �功, k média का साँचिक द body ऐसे बसत हैं, उव AWS न अंघो surveika the function that takes as यह कर थे होग گरAB यही होग काー隻ी और र�王 Okay 2, 0, 1, 1, 1, 1 on प distribution of any other values being there वूँ next is the first practice problem this function is called int next turn so you have x1 x2 x3 xn the function definition is given so check if configuration is valid count number of zeros and ones and determine who moves next this is a sub problem the name of the function that you have to write is int next turn please note that this is neither iterative nor recursive this is just a function being called only once it has to take a configuration that has been given in terms of values of x1 x2 x3 x4 x5 x9 if we started with a valid configuration to begin with then when I call this again and again for different combinations of course the configuration will be valid because as I said the values will be either minus one or zero or one so for the time being write only those few lines of code which will count numbers of zeros and ones and determine who moves next the nine variables x1 x2 x3 x4 x5 x6 x7 x8 x9 you have to count the number of zeros and number of ones and determine whether the next turn is zero or one zero means the first player moves one means the second player again I repeat it is not an iterative or recursive function it is a function which comes in with a set of nine values and returns only one value zero or one and that value should represent whose turn it is next to move you will notice that although I said you need not check if the configuration is valid but during the process of evaluating the count of zeros and ones you will be examining each and every variable anyway so you will be able to examine if it is neither zero nor one then it is is it minus one or not and validity can be examined by the way the validity will merely mean that the total number of zeros and ones should mismatch at the most by one I again repeat for those of you who are still wondering whether we are talking about iteration or we are talking about recursion we are talking about neither we are talking about a plain c++ function to be written with the name next turn the description of the function is already given you just have to write code inside these brushes this is also written just this code and of course you have to return a value which should be either zero or one here is a solution from lavish and I am going to request him to rewrite but the general approach is correct I would like to briefly discuss so this is his next turn function will ignore the first line and concentrate on what he has tried to write next he starts with zeros I do not know why he has equal equal zero to zeros it should be just a single zero you are assigning the initial value but look at what he is doing is if x1 is zero the number of zeros are added by one else if x1 equal to one ones are added by one there is no else further so we do not know the remaining value whether it is minus one or not but that is what is assumed which is okay but now look at the next form if x2 equal to zero zeros are added further else once are added so far so good then I asked him what is this dot dot dot dot so he said sir similar things now if I am a c++ compiler I will try to compile every dot into something and I will have no choice but to give gullies saying I cannot figure this out the reason I picked it up is that the logic that he is implementing is correct but the way he is implementing it is a longish way what is the faster way of doing this somebody says function somebody says array this itself is a function I am trying to write a code which will achieve some computations inside that function and I don't want to call another function I want to do all the computations here anybody who has thought of a switch statement somebody else has thought of array we have not yet discussed the array we will do that in the next week when you start working on it there is nothing wrong with this approach except that you are not supposed to write dot dot dot so please do the required work and write a complete program quickly you don't have much time sadly however that option is not available this is what you are supposed to do the function definition is given what is to be done is explicitly written in terms of three comments so I think what lavish was trying to do at least was to write a solution to this problem anybody got it bring it bring that solution let us listen to the expert advice on the method yeah sir if we take one player's input as one and one player's input as minus one and the spaces which are not marked as zero and we add all the inputs so the result will be means one or minus one or zero then we get the final result and we can say that the configuration is correct or no the first player's we can take one and the second player's we can take minus one I am very easily clear about what you are trying to do so let me try to expand you are saying I have nine inputs x1 x2 x3 x4 x5 x9 I simply find sum is equal to x1 plus x2 plus x3 plus x4 plus x9 fine what do I do with this sum yeah so the first I mean if we take the first player as one and the second player is minus one so if the sum is one or zero so the configuration is correct or if sum is something else then the configuration is wrong what if I give all the values as minus one that means the first player himself or herself has not yet played no sir if the person doesn't play or the box is empty we take it as zero no no they will be minus one which I am saying that oh you are changing the problem yes ah like our friend he is solving another problem which he thinks is solvable easy unfortunately my dear friend in life such options are rarely available and imagine if someone says I want a bicycle and you say I only know how to design and build a scooter so I'll give you a scooter so that fellow says I don't have a license to ride a scooter I need a bicycle so your solution house ever elegant is completely useless from a practical point of view sir we can convert all the minus ones to zero so now so he will now write a series of nine ifs to examine each variable and convert it to zero first and then he will do his elegant solution but if I have the liberty to write series of nine ifs I will get the solution itself no our friend here says take all the numbers and wherever there is minus one change it by something else what is a character a character a when we sum all of them so we get the asky the asky will end then do do more that asky whatever is the character he has another brilliant solution he is now using asky codes my my question is very simple this is the function you have to write what you have been told is this is what you will get to get the value a like our friend here you'll also have to write if x1 equal to minus one then x1 equal to asky a if x2 equal to minus one then x2 equal to asky a you'll have to do that kholagiri for all the numbers no but instead of defining it minus one we can define it a enough you are changing the problem when I come to this function these are the values you have got now you do whatever you want to do where have we where have we written that there is minus one for mts we are talking about the input configuration we have discussed this input configuration earlier and please note we are talking about a sub problem one of the main problem I am very happy that you are so creative that you are capable of changing the formulation itself unfortunately in real life you are required often to solve problems which people pose as problem we have wasted a lot of time in discussing reformulation of the problem I will have to sadly stop this discussion go to the next sub problem but please remember this please think of solutions in the context of the question not outside it you have an option of saying after solving this problem alternately I think there is a more brilliant solution which I now write that is perfectly fine but that has to be in addition to whatever you are required to do not in leave off given a configuration we want to determine if there is a winning or losing move a winning move of zero a move of zero from which there is at least one way for zero to win no matter how one plays please note there may be more than one and winning move one is similarly defined so please note this is the next level you have actually done that earlier part where you were required to find out whose turn it is now having found that you want to find out whether there is a winning or losing move to the next player and how is it defined winning move of zero is defined if there is at least one way for zero to win no matter how one plays at least one way the game presumably terminates after one player moves of wins so here is a configuration x1 and x3 are zero x2 and x6 are one rest are minus one if that is so then this is the solution now next move is that of zero the winning move of zero is here please note a winning move is not one which is actually winning but a winning move is one which is guarantee that no matter what the opponent plays next i will always win what he's saying is that if i set x5 then also the same situation exists the problem please read the problem carefully from which there is at least one way for zero to win that's a simpler problem there may be more than one option but there has to be at least one way that is what is required now it depends upon in which order you examine the remaining squares if you examine in this order then this then this so you will first examine this square this square then this and this and then this in which case when you examine this square and try to say that if i put my zero here i will get a guaranteed win then i may not have to do the other if i am examining these in this order in row order then i will of course come to this first and if i come to this first then i determine that if there is a zero i have a winning but depends on whichever order you do so this is one solution and this is another solution so at least two possible winning solutions must exist at that point out of which the opponent whose turn is next can block at most one then only it's a winning so guaranteed win for zero no matter how one plays and exactly the same way you can define the situation umma losing move a move from which there is at least winning one winning move for the opponent no matter whatever i do i am going to lose next time so similarly this situation next move is that of one losing move of one x6 equal to one so if i put this here please note we start with x1 and x3 is equal to zero and x2 equal to one so only this much has been played and one has to play now now if x is placed here there exists a winning move for zero subsequently therefore this is a losing move please understand this is how during the analysis of an actual game the mind backtracks and finds out if i do this what may happen next okay so this is the winning move so if zero has a winning move from a configuration then after this move is taken one cannot have a winning move after this and similarly same thing with the roles of one and zero is reversed if zero has a losing move from a configuration then after this move is taken one has a winning move from the new configuration these are the conclusions that you can draw based on now this is the sub problem too we'll leave it at that we are already late because we discussed so many alternative brilliant solutions everyone insisting on changing the problem in one's own way that we lost a lot of time so please do that i don't want to wrap on your creativity but do that independently after the class