title

Application of Linked List (Addition of Two Polynomials)

description

Data Structures: Application of Linked List (Addition of Two Polynomials)
Topics discussed:
1) C program to add the two polynomial using singly-linked lists.
Data Structures: https://bit.ly/3hjudFV
C Programming: https://goo.gl/7Eh2SS
Follow Neso Academy on Instagram: @nesoacademy(https://bit.ly/2XP63OE)
Follow me on Instagram: @jaspreetedu(https://bit.ly/2YX26E5)
Contribute: http://www.nesoacademy.org/donate
Memberships: https://bit.ly/2U7YSPI
Books: http://www.nesoacademy.org/recommended-books
Website ► http://www.nesoacademy.org/
Forum ► http://forum.nesoacademy.org/
Facebook ► https://goo.gl/Nt0PmB
Twitter ► https://twitter.com/nesoacademy
Music:
Axol x Alex Skrindo - You [NCS Release]
#DataStructuresByNeso #DataStructures #LinkedList #LinkedListApplication

detail

{'title': 'Application of Linked List (Addition of Two Polynomials)', 'heatmap': [{'end': 799.739, 'start': 771.897, 'weight': 1}], 'summary': 'Tutorial on the application of linked lists for adding polynomials demonstrates the process of combining like terms and the importance of arranging terms in descending order of exponents, using examples such as 3x^2 + 2x + 1 and 5x^2 - x + 2, and emphasizes the algorithm for adding polynomials using pointers and while loops, resulting in a polynomial with five terms.', 'chapters': [{'end': 47.534, 'segs': [{'end': 34.688, 'src': 'embed', 'start': 6.147, 'weight': 0, 'content': [{'end': 10.51, 'text': 'In this presentation, we will learn how to add two polynomials with the help of linked list.', 'start': 6.147, 'duration': 4.363}, {'end': 13.332, 'text': "So, without any further delay, let's get started.", 'start': 10.75, 'duration': 2.582}, {'end': 20.378, 'text': "Let's say we have these two polynomials, 3x squared plus 2x plus 1 and 5x squared minus x plus 2.", 'start': 13.693, 'duration': 6.685}, {'end': 25.341, 'text': 'These are the two polynomials we are available with and our target is to obviously add these two polynomials.', 'start': 20.378, 'duration': 4.963}, {'end': 31.005, 'text': 'Okay Addition of two polynomials involves combining like terms present in the two polynomials.', 'start': 25.581, 'duration': 5.424}, {'end': 34.688, 'text': 'Now, what do we mean by combining like terms present in the two polynomials?', 'start': 31.065, 'duration': 3.623}], 'summary': 'Learn to add two polynomials using linked list in a presentation.', 'duration': 28.541, 'max_score': 6.147, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp46147.jpg'}], 'start': 6.147, 'title': 'Adding polynomials', 'summary': 'Discusses adding polynomials using linked lists, involving 3x^2 + 2x + 1 and 5x^2 - x + 2, and explains the concept of combining like terms.', 'chapters': [{'end': 47.534, 'start': 6.147, 'title': 'Adding polynomials with linked list', 'summary': 'Discusses how to add two polynomials using linked lists, involving the addition of 3x^2 + 2x + 1 and 5x^2 - x + 2, and explains the concept of combining like terms.', 'duration': 41.387, 'highlights': ['The presentation focuses on adding two polynomials using linked lists, specifically addressing the addition of 3x^2 + 2x + 1 and 5x^2 - x + 2.', 'It emphasizes the concept of combining like terms, defined as terms with identical variables and exponents.']}], 'duration': 41.387, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp46147.jpg', 'highlights': ['The presentation focuses on adding two polynomials using linked lists, specifically addressing the addition of 3x^2 + 2x + 1 and 5x^2 - x + 2.', 'It emphasizes the concept of combining like terms, defined as terms with identical variables and exponents.']}, {'end': 513.479, 'segs': [{'end': 305.7, 'src': 'embed', 'start': 277.89, 'weight': 0, 'content': [{'end': 280.691, 'text': 'We can conclude this because their exponents are same.', 'start': 277.89, 'duration': 2.801}, {'end': 282.572, 'text': 'And obviously, variables are same as well.', 'start': 280.971, 'duration': 1.601}, {'end': 285.333, 'text': 'Therefore, these two terms are like terms.', 'start': 282.912, 'duration': 2.421}, {'end': 289.554, 'text': 'And hence, we can add their coefficients and this is what we will get as a result.', 'start': 285.673, 'duration': 3.881}, {'end': 291.274, 'text': 'That is thirty next to the power six.', 'start': 289.614, 'duration': 1.66}, {'end': 293.415, 'text': 'Right? Because eight plus five is thirty.', 'start': 291.554, 'duration': 1.861}, {'end': 299.437, 'text': 'After this, we must compare these two terms that is six x to the power four and three x to the power two.', 'start': 293.815, 'duration': 5.622}, {'end': 302.738, 'text': 'And comparing these two terms means comparing their exponents.', 'start': 299.577, 'duration': 3.161}, {'end': 305.7, 'text': 'You can clearly see this that four is greater than two.', 'start': 303.078, 'duration': 2.622}], 'summary': 'Like terms have coefficients 8 and 5, yielding 30x^6. exponents 4 > 2.', 'duration': 27.81, 'max_score': 277.89, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp4277890.jpg'}, {'end': 343.4, 'src': 'embed', 'start': 313.844, 'weight': 1, 'content': [{'end': 318.147, 'text': 'Now what we will do? We will simply select the term which has the highest exponent.', 'start': 313.844, 'duration': 4.303}, {'end': 322.049, 'text': 'You can clearly see this that this term is having the highest exponent.', 'start': 318.447, 'duration': 3.602}, {'end': 326.272, 'text': 'Therefore, we will select this term and we will add this term in the resultant polynomial.', 'start': 322.089, 'duration': 4.183}, {'end': 327.292, 'text': 'That is what we will do.', 'start': 326.432, 'duration': 0.86}, {'end': 332.075, 'text': 'And after this, the next step is to simply compare these two terms.', 'start': 327.632, 'duration': 4.443}, {'end': 337.677, 'text': 'Obviously, because we have selected this term and now we must compare these two terms right?', 'start': 332.455, 'duration': 5.222}, {'end': 343.4, 'text': 'Now you might be asking this question why I am simply adding the term which has the highest exponent?', 'start': 337.998, 'duration': 5.402}], 'summary': 'Select term with highest exponent, add to resultant polynomial, and compare with other term.', 'duration': 29.556, 'max_score': 313.844, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp4313844.jpg'}], 'start': 47.774, 'title': 'Adding polynomials and descending order', 'summary': 'Illustrates the addition of polynomials, emphasizing the process of adding like terms and demonstrates the addition of 3x^2 + 2x^1 + 1 and 5x^2 + x^1 + 2, resulting in 8x^2 + x^1 + 3. it also explains the importance of arranging terms in descending order of exponents when adding two polynomials, emphasizing the ease of addition and the necessity of comparing exponents to identify like terms, demonstrated through a linked list representation and a step-by-step comparison of terms.', 'chapters': [{'end': 123.549, 'start': 47.774, 'title': 'Adding polynomials', 'summary': 'Illustrates the addition of two polynomials, emphasizing the process of adding like terms and demonstrating the addition of 3x^2 + 2x^1 + 1 and 5x^2 + x^1 + 2, resulting in 8x^2 + x^1 + 3.', 'duration': 75.775, 'highlights': ['The resultant polynomial of adding 3x^2 and 5x^2 is 8x^2, emphasizing the process of adding coefficients to obtain the result.', 'The addition of 2x and x results in 3x, highlighting the combination of like terms with similar variables and exponents.', 'The addition of 1 and 2 yields 3, demonstrating the addition of constant terms in polynomials.']}, {'end': 513.479, 'start': 124.608, 'title': 'Adding polynomials and descending order', 'summary': 'Explains the importance of arranging terms in descending order of exponents when adding two polynomials, emphasizing the ease of addition and the necessity of comparing exponents to identify like terms, demonstrated through a linked list representation and a step-by-step comparison of terms.', 'duration': 388.871, 'highlights': ['Arranging terms in descending order of exponents simplifies addition, as demonstrated through comparing like terms and maintaining descending order in the resultant polynomial.', 'The step-by-step comparison of terms illustrates the necessity of comparing exponents to identify like terms and maintain the descending order in the resultant polynomial.', 'The linked list representation of polynomials with properly sorted exponents makes the addition operation easier and advisable.', 'The difficulty of addition when terms are not arranged in descending order of exponents is highlighted through the example of traversing the entire list to find equivalent terms, emphasizing the importance of maintaining the descending order.']}], 'duration': 465.705, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp447774.jpg', 'highlights': ['The resultant polynomial of adding 3x^2 and 5x^2 is 8x^2, emphasizing the process of adding coefficients to obtain the result.', 'Arranging terms in descending order of exponents simplifies addition, as demonstrated through comparing like terms and maintaining descending order in the resultant polynomial.', 'The step-by-step comparison of terms illustrates the necessity of comparing exponents to identify like terms and maintain the descending order in the resultant polynomial.']}, {'end': 1037.002, 'segs': [{'end': 639.778, 'src': 'embed', 'start': 611.707, 'weight': 4, 'content': [{'end': 617.45, 'text': 'insert the node pointed by ptr2 in the resultant link list and make ptr2 point to the next node.', 'start': 611.707, 'duration': 5.743}, {'end': 619.532, 'text': 'This is the complete algorithm.', 'start': 617.69, 'duration': 1.842}, {'end': 621.353, 'text': 'It is simple to understand.', 'start': 620.092, 'duration': 1.261}, {'end': 623.094, 'text': 'Now, here is iteration 1.', 'start': 621.713, 'duration': 1.381}, {'end': 630.198, 'text': 'Okay? Currently ptr1 pointer is pointing to the first node of this list and ptr2 pointer is pointing to the first node of this list.', 'start': 623.094, 'duration': 7.104}, {'end': 632.862, 'text': 'Here is the resultant linked list looks like.', 'start': 630.757, 'duration': 2.105}, {'end': 639.778, 'text': 'Currently, head three pointer is pointing to the first node and here we have just one node in this resultant linked list.', 'start': 633.063, 'duration': 6.715}], 'summary': 'Algorithm: insert ptr2 node in resultant link list, iter 1, 1 node in list', 'duration': 28.071, 'max_score': 611.707, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp4611707.jpg'}, {'end': 679.295, 'src': 'embed', 'start': 652.7, 'weight': 2, 'content': [{'end': 657.401, 'text': "So we'll put 13 over here and we'll put six as it is over here, that's it.", 'start': 652.7, 'duration': 4.701}, {'end': 660.261, 'text': 'And obviously this must contain null right?', 'start': 657.901, 'duration': 2.36}, {'end': 667.763, 'text': "Now, after this, we'll move both the pointers towards right and then we'll compare the exponent part of these two nodes.", 'start': 660.681, 'duration': 7.082}, {'end': 670.145, 'text': 'Here you can see 4 is greater than 2..', 'start': 668.243, 'duration': 1.902}, {'end': 673.749, 'text': 'Hence, we will put this node in the resultant linked list.', 'start': 670.145, 'duration': 3.604}, {'end': 677.213, 'text': 'Right? And we will simply move this pointer towards right.', 'start': 674.11, 'duration': 3.103}, {'end': 679.295, 'text': 'Now, we will compare these two nodes.', 'start': 677.593, 'duration': 1.702}], 'summary': 'Comparing and adding nodes based on their exponent values.', 'duration': 26.595, 'max_score': 652.7, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp4652700.jpg'}, {'end': 762.952, 'src': 'embed', 'start': 734.853, 'weight': 0, 'content': [{'end': 738.794, 'text': 'PTR1 is null, right? We will repeat until PTR2 becomes null.', 'start': 734.853, 'duration': 3.941}, {'end': 741.855, 'text': 'And we will add all the remaining nodes in the resultant linked list.', 'start': 739.034, 'duration': 2.821}, {'end': 744.295, 'text': 'First we will add this node in the resultant linked list.', 'start': 742.155, 'duration': 2.14}, {'end': 745.656, 'text': 'Then we will add this node.', 'start': 744.616, 'duration': 1.04}, {'end': 747.757, 'text': 'And then we will move pointer towards right.', 'start': 746.076, 'duration': 1.681}, {'end': 749.177, 'text': 'And we will add this node.', 'start': 748.117, 'duration': 1.06}, {'end': 752.618, 'text': 'And this is the resultant linked list so obtained.', 'start': 749.717, 'duration': 2.901}, {'end': 759.628, 'text': 'Right? And after this obviously PTR2 becomes null and this means this is the resultant linked list so obtained.', 'start': 753.038, 'duration': 6.59}, {'end': 762.952, 'text': 'Right? This represents the resultant polynomial.', 'start': 760.048, 'duration': 2.904}], 'summary': 'Repeat process until ptr2 becomes null, adding nodes to resultant linked list.', 'duration': 28.099, 'max_score': 734.853, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp4734853.jpg'}, {'end': 799.739, 'src': 'heatmap', 'start': 771.897, 'weight': 1, 'content': [{'end': 777.718, 'text': 'Here we have struct node which consists of float coefficient, integer expo and struct node starlink.', 'start': 771.897, 'duration': 5.821}, {'end': 782.38, 'text': 'Right? Then we have this insert function which I have taken from the previous lecture.', 'start': 778.038, 'duration': 4.342}, {'end': 784.84, 'text': 'We have this create function.', 'start': 783.48, 'duration': 1.36}, {'end': 786.501, 'text': 'I took this from the previous lecture.', 'start': 785.081, 'duration': 1.42}, {'end': 790.756, 'text': 'And this print function also I took from the previous lecture.', 'start': 788.095, 'duration': 2.661}, {'end': 793.457, 'text': 'And here we have polyadd function.', 'start': 791.636, 'duration': 1.821}, {'end': 795.798, 'text': "Let's see the main function first.", 'start': 794.397, 'duration': 1.401}, {'end': 799.739, 'text': 'Here you can see that I have declared a head one pointer and head two pointer.', 'start': 796.118, 'duration': 3.621}], 'summary': 'Transcript covers struct node, insert, create, print, and polyadd functions, along with main function declaration.', 'duration': 27.842, 'max_score': 771.897, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp4771897.jpg'}, {'end': 966.492, 'src': 'embed', 'start': 939.67, 'weight': 3, 'content': [{'end': 944.835, 'text': "Finally, I'm printing this message that is added polynomial is and then I'm calling this print function.", 'start': 939.67, 'duration': 5.165}, {'end': 947.418, 'text': 'Okay, and this is how this print function looks like.', 'start': 945.055, 'duration': 2.363}, {'end': 949.1, 'text': 'This is the print function.', 'start': 948.039, 'duration': 1.061}, {'end': 955.664, 'text': 'This function we have already seen in the previous lecture, right? Only this piece of code is new in this whole program.', 'start': 949.68, 'duration': 5.984}, {'end': 959.747, 'text': 'Rest of the code is same as what we have seen in the previous lecture.', 'start': 955.965, 'duration': 3.782}, {'end': 961.328, 'text': 'Let me just execute this code.', 'start': 960.107, 'duration': 1.221}, {'end': 966.492, 'text': 'It is asking us to enter the first polynomial and it is also asking us to enter the number of terms.', 'start': 961.829, 'duration': 4.663}], 'summary': 'Printing a new polynomial in the program, with familiar code structure.', 'duration': 26.822, 'max_score': 939.67, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp4939670.jpg'}], 'start': 513.94, 'title': 'Polynomial addition algorithm', 'summary': 'Explains the algorithm for adding polynomials using pointers, comparing exponent parts, and traversing linked lists, resulting in a new linked list. it also illustrates the logic for adding polynomials using while loops, insert function, and pointers, resulting in a polynomial with five terms.', 'chapters': [{'end': 837.843, 'start': 513.94, 'title': 'Algorithm for polynomial addition', 'summary': 'Explains the algorithm for adding two polynomials using pointers, comparing exponent parts, and traversing linked lists until ptr1 or ptr2 becomes null, resulting in a new linked list representing the addition of the two polynomials.', 'duration': 323.903, 'highlights': ['The algorithm explains the process of adding two polynomials by comparing exponent parts, adding coefficients, and inserting nodes into the resultant linked list until PTR1 or PTR2 becomes null. Process of adding two polynomials', 'The chapter demonstrates the step-by-step iteration and comparison of exponent parts, resulting in the creation of a new linked list representing the addition of the two polynomials. Step-by-step iteration and comparison', 'The code is presented, including the struct node, insert function, create function, and polyadd function, providing an overall understanding of the implementation. Presentation of the code and functions']}, {'end': 1037.002, 'start': 838.277, 'title': 'Adding polynomials logic', 'summary': 'Explains the logic for adding polynomials using while loops, insert function, and incrementing pointers, ultimately resulting in the added polynomial with a total of five terms.', 'duration': 198.725, 'highlights': ['Explaining the logic for adding polynomials using while loops, insert function, and incrementing pointers, ultimately resulting in the added polynomial with a total of five terms.', 'Describing the process of entering coefficients and exponents for two polynomials and demonstrating the resultant added polynomial.', 'Declaring two pointers, right. And here we have head3 pointer which is currently holding null. This pointer must point to the first node of the resultant linked list after completion of this code.']}], 'duration': 523.062, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/cFHZ-a87Vp4/pics/cFHZ-a87Vp4513940.jpg', 'highlights': ['The algorithm explains the process of adding two polynomials by comparing exponent parts, adding coefficients, and inserting nodes into the resultant linked list until PTR1 or PTR2 becomes null. Process of adding two polynomials', 'Explaining the logic for adding polynomials using while loops, insert function, and incrementing pointers, ultimately resulting in the added polynomial with a total of five terms.', 'The chapter demonstrates the step-by-step iteration and comparison of exponent parts, resulting in the creation of a new linked list representing the addition of the two polynomials. Step-by-step iteration and comparison', 'The code is presented, including the struct node, insert function, create function, and polyadd function, providing an overall understanding of the implementation. Presentation of the code and functions', 'Describing the process of entering coefficients and exponents for two polynomials and demonstrating the resultant added polynomial.']}], 'highlights': ['The algorithm explains the process of adding two polynomials by comparing exponent parts, adding coefficients, and inserting nodes into the resultant linked list until PTR1 or PTR2 becomes null. Process of adding two polynomials', 'The chapter demonstrates the step-by-step iteration and comparison of exponent parts, resulting in the creation of a new linked list representing the addition of the two polynomials. Step-by-step iteration and comparison', 'The code is presented, including the struct node, insert function, create function, and polyadd function, providing an overall understanding of the implementation. Presentation of the code and functions', 'Describing the process of entering coefficients and exponents for two polynomials and demonstrating the resultant added polynomial.', 'Arranging terms in descending order of exponents simplifies addition, as demonstrated through comparing like terms and maintaining descending order in the resultant polynomial.', 'The resultant polynomial of adding 3x^2 and 5x^2 is 8x^2, emphasizing the process of adding coefficients to obtain the result.', 'It emphasizes the concept of combining like terms, defined as terms with identical variables and exponents.', 'The presentation focuses on adding two polynomials using linked lists, specifically addressing the addition of 3x^2 + 2x + 1 and 5x^2 - x + 2.']}