WEBVTT 00:00.210 --> 00:04.740 If you want to succeed a supper organ most useful change the fundamental way of your thinking. 00:04.740 --> 00:06.540 Imagine that you drag the chains. 00:06.560 --> 00:08.720 They are these are in your trading system. 00:08.780 --> 00:13.020 Now let us show that you succeeded degrees that aren't dime of these function. 00:13.050 --> 00:14.850 What about one and a second. 00:14.850 --> 00:16.480 This is nothing important right. 00:16.570 --> 00:17.800 You create a program. 00:17.880 --> 00:22.200 His theory looks ten thousand days from its one into five ADC. 00:22.350 --> 00:27.930 The actual number of the issuance vs ten thousand by three multiplied by five. 00:27.930 --> 00:31.480 So here we have this number of additions in this particular program. 00:31.500 --> 00:36.710 We can see approximately five thousand seconds which is about 83 minutes. 00:36.710 --> 00:39.980 In other words if hearing boards and optimization in our program. 00:40.020 --> 00:44.900 So let's try to turn on this suite of dynamic programming. 00:51.490 --> 00:56.200 Let's try to craft our way of things from a simple primary school problem. 00:56.200 --> 00:58.570 Suppose there are five apples in the basket. 00:58.650 --> 00:59.900 In a we add two more. 00:59.950 --> 01:02.610 Obviously we will find all seven others. 01:02.660 --> 01:06.350 How can you be sure about the result we salt count it. 01:06.400 --> 01:07.690 There are five apples. 01:07.690 --> 01:08.680 We put two more. 01:08.680 --> 01:10.850 So five Bastille is equal to seven. 01:10.930 --> 01:13.750 But in this case you didn't count the apples. 01:13.810 --> 01:15.610 You'd just add them in there. 01:15.640 --> 01:16.970 The answer right. 01:17.060 --> 01:23.980 I'm right now focussing on the count itself but can't dig from zero is not necessary when we already 01:23.980 --> 01:26.490 know the previous number of our. 01:26.500 --> 01:28.440 This is dowsed waste of time here. 01:28.480 --> 01:34.580 Again optimize by using memory in more specifically by adding the previous number instead of a test 01:34.600 --> 01:36.110 counting from zero. 01:36.110 --> 01:38.240 Suppose that you want to find the best more. 01:38.300 --> 01:41.350 You need some like cogswell and masra on offence. 01:41.490 --> 01:42.310 How does the computer do. 01:42.310 --> 01:47.350 We've got a leg down that based on a function it will evaluate every more. 01:47.570 --> 01:51.950 The key is that you want to go a step further and find out the best more. 01:51.970 --> 01:53.320 There are two ways. 01:53.350 --> 01:59.830 The first one is to compare all mori's on every Xandra on the same criteria and the second is to keep 01:59.830 --> 02:05.620 memory of the three more ways that that are the best in every category in compare onlly them. 02:05.620 --> 02:12.140 The idea here is to reduce computational time in overall optimize our programs by using already available 02:12.140 --> 02:12.860 results. 02:12.970 --> 02:19.180 Same way can be applied to find out that the log is 3 but in the war we already have at least over the 02:19.180 --> 02:19.860 longest. 02:19.950 --> 02:21.140 But in its country. 02:21.220 --> 02:27.230 Find out a solution more efficiently using previously obtained the desired is called dynamic programming. 02:27.280 --> 02:34.240 In computer science first we divide problems in those smaller ones by 5 the bad into singularities. 02:34.240 --> 02:40.590 The goal here is to solve a unique problem only once and use it to obtain big problem solutions. 02:40.750 --> 02:45.960 Dynamic programming eliminate predictive tasks in order to get the faster solution. 02:46.000 --> 02:51.770 If we find bad then as it does SAP problems of a given problem would again our blyde dynamic program. 02:51.880 --> 02:54.130 Let's try a mathematical example. 02:54.190 --> 02:59.670 We use dynamic programming to find the doorbell of any number of Forth Victoria. 02:59.690 --> 03:04.460 Each of them will duplicates one of any number of from one with a particular number. 03:04.480 --> 03:07.070 Entities do not do it by exclamation mark. 03:07.090 --> 03:13.210 This simplest method to program or ayles brute force method for calculating all the factorials up to 03:13.210 --> 03:22.310 a given number is to calculate its fucked or l n add to the least like proctoring and 5 factorial seeks. 03:22.570 --> 03:25.190 But what about the dynamic programming approach. 03:25.300 --> 03:31.120 First we need to find that bad debt and that will allow us to use these the can between this have problems 03:31.120 --> 03:33.170 with the find the factoid up to n. 03:33.190 --> 03:40.300 You should calculate the factorial of N minus 1 and then multiplied by n factor in a sikh's is equal 03:40.300 --> 03:42.500 to sikh's by factorial 5. 03:42.670 --> 03:48.100 Now the important bad for this implementation of dynamic programming is to save for the information 03:48.120 --> 03:49.260 for further use. 03:49.270 --> 03:54.490 We will create an narey in we'd able cell will see with a factorial for a number. 03:54.490 --> 03:59.720 For example the first cell has the number one then the number two and the number 6. 03:59.740 --> 04:06.190 So to find the factory of four we test needed to multiply four with the previous cell number 6 and we 04:06.190 --> 04:08.220 will cover the number 24. 04:08.290 --> 04:11.480 In this way we eliminate a bearded calculation.