videos/02-algo2.srt
changeset 772 3bf3f5bb067e
parent 769 f9686b22db7e
child 773 260e330f7466
equal deleted inserted replaced
771:3a12e096f9a0 772:3bf3f5bb067e
     1 1
     1 1
     2 00:00:06,020 --> 00:00:09,945
     2 00:00:06,020 --> 00:00:09,945
     3 They come back after
     3 Welcome back. After
     4 this disappointment
     4 this disappointment
     5 
     5 
     6 2
     6 2
     7 00:00:09,945 --> 00:00:14,115
     7 00:00:09,945 --> 00:00:14,115
     8 and case of over promising
     8 and case of over-promising
     9 and under achieving.
     9 and under-achieving,
    10 
    10 
    11 3
    11 3
    12 00:00:14,115 --> 00:00:17,295
    12 00:00:14,115 --> 00:00:17,295
    13 Let's have a look whether
    13 let's have a look whether
    14 we can recover from that.
    14 we can recover from that.
    15 
    15 
    16 4
    16 4
    17 00:00:17,295 --> 00:00:20,535
    17 00:00:17,295 --> 00:00:20,535
    18 So here's one problem.
    18 So here's one problem.
    19 
    19 
    20 5
    20 5
    21 00:00:20,535 --> 00:00:23,790
    21 00:00:20,535 --> 00:00:23,790
    22 Then we looked at this end
    22 When we looked at this 
    23 times vk expression and
    23 n-times regular expression, we
    24 
    24 
    25 6
    25 6
    26 00:00:23,790 --> 00:00:27,330
    26 00:00:23,790 --> 00:00:27,330
    27 be able to represent
    27 were not able to represent
    28 that directly.
    28 that directly.
    29 
    29 
    30 7
    30 7
    31 00:00:27,330 --> 00:00:31,275
    31 00:00:27,330 --> 00:00:31,275
    32 We had two represented as a
    32 We had to represent it as a
    33 sequence record expression.
    33 sequence regular expression.
    34 
    34 
    35 8
    35 8
    36 00:00:31,275 --> 00:00:32,850
    36 00:00:31,275 --> 00:00:32,850
    37 So we expanded it.
    37 So we expanded it.
    38 
    38 
    39 9
    39 9
    40 00:00:32,850 --> 00:00:36,510
    40 00:00:32,850 --> 00:00:36,510
    41 So times one would be just a,
    41 So times-one would be just a,
    42 
    42 
    43 10
    43 10
    44 00:00:36,510 --> 00:00:40,595
    44 00:00:36,510 --> 00:00:40,595
    45 t, times two would
    45 times-two would
    46 be a, and so on.
    46 be a o a, and so on.
    47 
    47 
    48 11
    48 11
    49 00:00:40,595 --> 00:00:43,535
    49 00:00:40,595 --> 00:00:43,535
    50 And so you can see if
    50 And so you can see if
    51 you go already to 13,
    51 you go already to 13,
    52 
    52 
    53 12
    53 12
    54 00:00:43,535 --> 00:00:47,960
    54 00:00:43,535 --> 00:00:47,960
    55 N equals 13, the record
    55 n equals 13, the regular
    56 expression becomes quite large.
    56 expression becomes quite large.
    57 
    57 
    58 13
    58 13
    59 00:00:47,960 --> 00:00:52,865
    59 00:00:47,960 --> 00:00:52,865
    60 And now the functions
    60 And now the functions
    61 nullable and also derivative.
    61 nullable and also derivative,
    62 
    62 
    63 14
    63 14
    64 00:00:52,865 --> 00:00:56,360
    64 00:00:52,865 --> 00:00:56,360
    65 They need to traverse
    65 they need to traverse
    66 this reg expression.
    66 this regular expression.
    67 
    67 
    68 15
    68 15
    69 00:00:56,360 --> 00:00:59,060
    69 00:00:56,360 --> 00:00:59,060
    70 Remember this tree in sometimes
    70 Remember this tree, sometimes,
    71 
    71 
    72 16
    72 16
    73 00:00:59,060 --> 00:01:01,820
    73 00:00:59,060 --> 00:01:01,820
    74 they have to traverse
    74 they have to traverse
    75 that even several times.
    75 that even several times.
    80 down the algorithm.
    80 down the algorithm.
    81 
    81 
    82 18
    82 18
    83 00:01:04,535 --> 00:01:08,150
    83 00:01:04,535 --> 00:01:08,150
    84 And in particular, because
    84 And in particular, because
    85 our first reg expression was
    85 our first regular expression was
    86 
    86 
    87 19
    87 19
    88 00:01:08,150 --> 00:01:11,840
    88 00:01:08,150 --> 00:01:11,840
    89 actually not just a bot
    89 actually not just a, but
    90 a plus one. So b hat.
    90 a + 1. So we had
    91 
    91 
    92 20
    92 20
    93 00:01:11,840 --> 00:01:14,330
    93 00:01:11,840 --> 00:01:14,330
    94 In the case of 13,
    94 in the case of 13,
    95 we had a plus one,
    95 we had a + 1, a + 1,...
    96 
    96 
    97 21
    97 21
    98 00:01:14,330 --> 00:01:17,330
    98 00:01:14,330 --> 00:01:17,330
    99 a plus one a plus born 13 times.
    99 a + 1... 13 times.
   100 
   100 
   101 22
   101 22
   102 00:01:17,330 --> 00:01:20,150
   102 00:01:17,330 --> 00:01:20,150
   103 And this reg
   103 And this regular
   104 expression just grows,
   104 expression just grows
   105 
   105 
   106 23
   106 23
   107 00:01:20,150 --> 00:01:25,475
   107 00:01:20,150 --> 00:01:25,475
   108 stay in number n. Just to
   108 with the number n. Just to
   109 show you this also encode,
   109 show you this also in code,
   110 
   110 
   111 24
   111 24
   112 00:01:25,475 --> 00:01:28,115
   112 00:01:25,475 --> 00:01:28,115
   113 I'm Stern, This File rewarm
   113 I'm in the file re1.sc,
   114 
   114 
   115 25
   115 25
   116 00:01:28,115 --> 00:01:30,920
   116 00:01:28,115 --> 00:01:30,920
   117 and D and I have a size function.
   117 and in the end I have a size function.
   118 
   118 
   119 26
   119 26
   120 00:01:30,920 --> 00:01:33,140
   120 00:01:30,920 --> 00:01:33,140
   121 The size function takes
   121 The size function takes
   122 a regular expression as
   122 a regular expression as
   123 
   123 
   124 27
   124 27
   125 00:01:33,140 --> 00:01:36,215
   125 00:01:33,140 --> 00:01:36,215
   126 argument and produces in teacher.
   126 argument and produces an integer.
   127 
   127 
   128 28
   128 28
   129 00:01:36,215 --> 00:01:39,980
   129 00:01:36,215 --> 00:01:39,980
   130 And essentially it takes
   130 And essentially it takes
   131 this rec expression scene as
   131 this regular expression, seen as
   132 
   132 
   133 29
   133 29
   134 00:01:39,980 --> 00:01:44,045
   134 00:01:39,980 --> 00:01:44,045
   135 a tree and count how many
   135 a tree and counts how many
   136 nodes are in this tree.
   136 nodes there are in this tree.
   137 
   137 
   138 30
   138 30
   139 00:01:44,045 --> 00:01:49,490
   139 00:01:44,045 --> 00:01:49,490
   140 And so if I take this even
   140 And so if I take this EVIL1
   141 one reg expression, this one,
   141 regular expression, this one,
   142 
   142 
   143 31
   143 31
   144 00:01:49,490 --> 00:01:52,160
   144 00:01:49,490 --> 00:01:52,160
   145 and increase now this n. So you
   145 and increase now this n. So you
   146 
   146 
   147 32
   147 32
   148 00:01:52,160 --> 00:01:54,680
   148 00:01:52,160 --> 00:01:54,680
   149 can already see
   149 can already see
   150 for any cross one,
   150 for n = 1,
   151 
   151 
   152 33
   152 33
   153 00:01:54,680 --> 00:01:56,540
   153 00:01:54,680 --> 00:01:56,540
   154 the size of this
   154 the size of this
   155 record expression is
   155 record expression is 5
   156 
   156 
   157 34
   157 34
   158 00:01:56,540 --> 00:01:59,615
   158 00:01:56,540 --> 00:01:59,615
   159 five and you see it
   159 and you see it
   160 slowly increases.
   160 slowly increases.
   161 
   161 
   162 35
   162 35
   163 00:01:59,615 --> 00:02:02,150
   163 00:01:59,615 --> 00:02:02,150
   164 And this 20 n equals 20.
   164 And this 20, i.e. n = 20,
   165 
   165 
   166 36
   166 36
   167 00:02:02,150 --> 00:02:07,100
   167 00:02:02,150 --> 00:02:07,100
   168 The size of this record
   168 the size of this regular
   169 expression is SMOW already a 119.
   169 expression is now already 119.
   170 
   170 
   171 37
   171 37
   172 00:02:07,100 --> 00:02:10,145
   172 00:02:07,100 --> 00:02:10,145
   173 So now the interesting
   173 The interesting
   174 line as this one.
   174 line is this one.
   175 
   175 
   176 38
   176 38
   177 00:02:10,145 --> 00:02:13,295
   177 00:02:10,145 --> 00:02:13,295
   178 Remember it when we
   178 Remember, when we
   179 built the derivative,
   179 built the derivative,
   180 
   180 
   181 39
   181 39
   182 00:02:13,295 --> 00:02:17,150
   182 00:02:13,295 --> 00:02:17,150
   183 very often parts of a reg
   183 very often parts of a regular
   184 expression gets copied.
   184 expression gets copied.
   185 
   185 
   186 40
   186 40
   187 00:02:17,150 --> 00:02:19,280
   187 00:02:17,150 --> 00:02:19,280
   188 So if you have like EVA,
   188 So if you have like EVIL1
   189 
   189 
   190 41
   190 41
   191 00:02:19,280 --> 00:02:22,325
   191 00:02:19,280 --> 00:02:22,325
   192 one of 2019 nodes,
   192 of 20, and you have 119 nodes,
   193 
   193 
   194 42
   194 42
   195 00:02:22,325 --> 00:02:25,475
   195 00:02:22,325 --> 00:02:25,475
   196 now this will be often copied.
   196 now this will be often copied.
   197 
   197 
   198 43
   198 43
   199 00:02:25,475 --> 00:02:31,475
   199 00:02:25,475 --> 00:02:31,475
   200 And we want to see what's the
   200 And we want to see what's the
   201 resulting tree look like,
   201 resulting tree look like, i.e.
   202 
   202 
   203 44
   203 44
   204 00:02:31,475 --> 00:02:32,780
   204 00:02:31,475 --> 00:02:32,780
   205 how many nodes it has.
   205 how many nodes does it have.
   206 
   206 
   207 45
   207 45
   208 00:02:32,780 --> 00:02:34,985
   208 00:02:32,780 --> 00:02:34,985
   209 So I take here either one of 20
   209 So I take here EVIL1 of 20
   210 
   210 
   211 46
   211 46
   212 00:02:34,985 --> 00:02:38,405
   212 00:02:34,985 --> 00:02:38,405
   213 and the derivative
   213 and the derivative
   214 according to 20 a's.
   214 according to 20 a's.
   218 And just have a look
   218 And just have a look
   219 what the size is.
   219 what the size is.
   220 
   220 
   221 48
   221 48
   222 00:02:43,210 --> 00:02:45,680
   222 00:02:43,210 --> 00:02:45,680
   223 Okay, that takes away.
   223 Okay, that takes a while.
   224 
   224 
   225 49
   225 49
   226 00:02:45,680 --> 00:02:48,410
   226 00:02:45,680 --> 00:02:48,410
   227 You see now this rec expression,
   227 You see now this recular expression,
   228 
   228 
   229 50
   229 50
   230 00:02:48,410 --> 00:02:52,280
   230 00:02:48,410 --> 00:02:52,280
   231 the derivative has already
   231 the derivative has already
   232 8 million plus nodes.
   232 8 million plus nodes.
   237 derivative have to
   237 derivative have to
   238 
   238 
   239 52
   239 52
   240 00:02:55,400 --> 00:02:58,430
   240 00:02:55,400 --> 00:02:58,430
   241 traverse these trees with
   241 traverse these trees with
   242 a million plus nodes.
   242 8 million plus nodes.
   243 
   243 
   244 53
   244 53
   245 00:02:58,430 --> 00:03:01,400
   245 00:02:58,430 --> 00:03:01,400
   246 So it's no wonder
   246 So it's no wonder
   247 that this is slow.
   247 that this is slow.
   255 00:03:03,860 --> 00:03:06,350
   255 00:03:03,860 --> 00:03:06,350
   256 this explosion problem is to
   256 this explosion problem is to
   257 
   257 
   258 56
   258 56
   259 00:03:06,350 --> 00:03:09,050
   259 00:03:06,350 --> 00:03:09,050
   260 have an explicit and
   260 have an explicit 
   261 times reg expression.
   261 n-times regular expression.
   262 
   262 
   263 57
   263 57
   264 00:03:09,050 --> 00:03:11,600
   264 00:03:09,050 --> 00:03:11,600
   265 So instead of expanding
   265 So instead of expanding
   266 
   266 
   267 58
   267 58
   268 00:03:11,600 --> 00:03:13,415
   268 00:03:11,600 --> 00:03:13,415
   269 it to the sequence
   269 it to the sequence
   270 reg expression,
   270 regular expression,
   271 
   271 
   272 59
   272 59
   273 00:03:13,415 --> 00:03:17,510
   273 00:03:13,415 --> 00:03:17,510
   274 let's just have a single
   274 let's just have a single
   275 wreck expression and times,
   275 regular expression n-times,
   276 
   276 
   277 60
   277 60
   278 00:03:17,510 --> 00:03:20,540
   278 00:03:17,510 --> 00:03:20,540
   279 which takes an expression and
   279 which takes an expression and
   280 
   280 
   281 61
   281 61
   282 00:03:20,540 --> 00:03:24,470
   282 00:03:20,540 --> 00:03:24,470
   283 a number and keeps that
   283 a number, and keeps that
   284 regular expression Small.
   284 regular expression small.
   285 
   285 
   286 62
   286 62
   287 00:03:24,470 --> 00:03:27,095
   287 00:03:24,470 --> 00:03:27,095
   288 I'm here in the fire V2,
   288 I'm here in the file re2.sc,
   289 
   289 
   290 63
   290 63
   291 00:03:27,095 --> 00:03:29,090
   291 00:03:27,095 --> 00:03:29,090
   292 which is also on Keats.
   292 which is also on KEATS.
   293 
   293 
   294 64
   294 64
   295 00:03:29,090 --> 00:03:32,570
   295 00:03:29,090 --> 00:03:32,570
   296 And the only change I made
   296 And the only change I made
   297 is I added explicitly
   297 is I added explicitly
   298 
   298 
   299 65
   299 65
   300 00:03:32,570 --> 00:03:33,860
   300 00:03:32,570 --> 00:03:33,860
   301 a wrecker expression for
   301 a regular expression for
   302 
   302 
   303 66
   303 66
   304 00:03:33,860 --> 00:03:36,770
   304 00:03:33,860 --> 00:03:36,770
   305 N times the optional
   305 n-times. The optional
   306 reg expression.
   306 regular expression
   307 
   307 
   308 67
   308 67
   309 00:03:36,770 --> 00:03:39,920
   309 00:03:36,770 --> 00:03:39,920
   310 Very leaf out at the
   310 we leave out at the
   311 moment because this a
   311 moment because this a?
   312 
   312 
   313 68
   313 68
   314 00:03:39,920 --> 00:03:41,975
   314 00:03:39,920 --> 00:03:41,975
   315 optional is represented as
   315 is represented as
   316 
   316 
   317 69
   317 69
   318 00:03:41,975 --> 00:03:44,645
   318 00:03:41,975 --> 00:03:44,645
   319 a plus one and doesn't
   319 a + 1 and doesn't
   320 explain too much.
   320 expand too much.
   321 
   321 
   322 70
   322 70
   323 00:03:44,645 --> 00:03:47,375
   323 00:03:44,645 --> 00:03:47,375
   324 The really the culprit
   324 The real culprit
   325 is this n times.
   325 is this n-times.
   326 
   326 
   327 71
   327 71
   328 00:03:47,375 --> 00:03:51,095
   328 00:03:47,375 --> 00:03:51,095
   329 And instead of expanding
   329 And instead of expanding
   330 it n times, which has,
   330 it n-times, we just
   331 
   331 
   332 72
   332 72
   333 00:03:51,095 --> 00:03:54,275
   333 00:03:51,095 --> 00:03:54,275
   334 take here a wreck expression
   334 take here a regular expression
   335 and a natural number,
   335 and a natural number,
   336 
   336 
   337 73
   337 73
   338 00:03:54,275 --> 00:03:56,960
   338 00:03:54,275 --> 00:03:56,960
   339 which says how many times
   339 which says how many times
   345 can keep it small.
   345 can keep it small.
   346 
   346 
   347 75
   347 75
   348 00:03:59,165 --> 00:04:01,370
   348 00:03:59,165 --> 00:04:01,370
   349 But by adding that
   349 But by adding that
   350 reg expression,
   350 regular expression,
   351 
   351 
   352 76
   352 76
   353 00:04:01,370 --> 00:04:05,150
   353 00:04:01,370 --> 00:04:05,150
   354 we now have to think about
   354 we now have to think about
   355 cases for nullable and
   355 cases for nullable and
   356 
   356 
   357 77
   357 77
   358 00:04:05,150 --> 00:04:07,340
   358 00:04:05,150 --> 00:04:07,340
   359 derivative so that we have
   359 derivative. So that we have
   360 
   360 
   361 78
   361 78
   362 00:04:07,340 --> 00:04:10,205
   362 00:04:07,340 --> 00:04:10,205
   363 to now calculate next
   363 to calculate next
   364 what they look like.
   364 what they look like.
   365 
   365 
   366 79
   366 79
   367 00:04:10,205 --> 00:04:14,060
   367 00:04:10,205 --> 00:04:14,060
   368 We can actually
   368 We can actually
   378 Remember, if you have
   378 Remember, if you have
   379 a regular expression,
   379 a regular expression,
   380 
   380 
   381 82
   381 82
   382 00:04:19,580 --> 00:04:21,980
   382 00:04:19,580 --> 00:04:21,980
   383 R and B take in
   383 r and we take it
   384 times of this are,
   384 n-times of this r,
   385 
   385 
   386 83
   386 83
   387 00:04:21,980 --> 00:04:25,220
   387 00:04:21,980 --> 00:04:25,220
   388 then indicates if n equals 0,
   388 then in case if n = 0,
   389 
   389 
   390 84
   390 84
   391 00:04:25,220 --> 00:04:28,130
   391 00:04:25,220 --> 00:04:28,130
   392 we find that as the
   392 we definded that as the
   393 one reg expression.
   393 1 regular expression.
   394 
   394 
   395 85
   395 85
   396 00:04:28,130 --> 00:04:30,380
   396 00:04:28,130 --> 00:04:30,380
   397 If n equals one,
   397 If n = 1,
   398 
   398 
   399 86
   399 86
   400 00:04:30,380 --> 00:04:32,495
   400 00:04:30,380 --> 00:04:32,495
   401 it will be just a
   401 it will be just a
   402 single copy of on.
   402 single copy of r.
   403 
   403 
   404 87
   404 87
   405 00:04:32,495 --> 00:04:33,725
   405 00:04:32,495 --> 00:04:33,725
   406 If n equals two,
   406 If n = 2,
   407 
   407 
   408 88
   408 88
   409 00:04:33,725 --> 00:04:35,270
   409 00:04:33,725 --> 00:04:35,270
   410 it will be two copies.
   410 it will be two copies in sequence.
   411 
   411 
   412 89
   412 89
   413 00:04:35,270 --> 00:04:39,260
   413 00:04:35,270 --> 00:04:39,260
   414 Sequence if three, we have
   414 If three, we have
   415 three copies and so on.
   415 three copies and so on.
   416 
   416 
   417 90
   417 90
   418 00:04:39,260 --> 00:04:41,390
   418 00:04:39,260 --> 00:04:41,390
   419 Now we have to
   419 Now we have to
   420 somehow characterize
   420 somehow characterize
   421 
   421 
   422 91
   422 91
   423 00:04:41,390 --> 00:04:44,285
   423 00:04:41,390 --> 00:04:44,285
   424 when these cases all nullable.
   424 when are these cases all nullable.
   425 
   425 
   426 92
   426 92
   427 00:04:44,285 --> 00:04:47,810
   427 00:04:44,285 --> 00:04:47,810
   428 Well, if n equals 0,
   428 Well, if n equals 0,
   429 
   429 
   430 93
   430 93
   431 00:04:47,810 --> 00:04:49,850
   431 00:04:47,810 --> 00:04:49,850
   432 then this will be defined as one,
   432 then this will be defined as 1.
   433 
   433 
   434 94
   434 94
   435 00:04:49,850 --> 00:04:52,100
   435 00:04:49,850 --> 00:04:52,100
   436 so one can match
   436 So 1 can match
   437 the empty string.
   437 the empty string.
   438 
   438 
   439 95
   439 95
   440 00:04:52,100 --> 00:04:54,785
   440 00:04:52,100 --> 00:04:54,785
   441 So that should be
   441 So that should be
   442 definitely true.
   442 definitely true.
   443 
   443 
   444 96
   444 96
   445 00:04:54,785 --> 00:04:57,725
   445 00:04:54,785 --> 00:04:57,725
   446 Okay, if any cross one,
   446 Okay, if n = 1,
   447 
   447 
   448 97
   448 97
   449 00:04:57,725 --> 00:05:00,470
   449 00:04:57,725 --> 00:05:00,470
   450 when can this reg expression
   450 when can this regular expression
   451 match the empty string?
   451 match the empty string?
   452 
   452 
   453 98
   453 98
   454 00:05:00,470 --> 00:05:02,000
   454 00:05:00,470 --> 00:05:02,000
   455 So vent should be nullable.
   455 So when should this be nullable?
   456 
   456 
   457 99
   457 99
   458 00:05:02,000 --> 00:05:07,535
   458 00:05:02,000 --> 00:05:07,535
   459 Well, if nullable of our holes,
   459 Well, if nullable of r holds,
   460 
   460 
   461 100
   461 100
   462 00:05:07,535 --> 00:05:09,860
   462 00:05:07,535 --> 00:05:09,860
   463 okay, so if I can match
   463 If it can match
   464 the empty string,
   464 the empty string,
   465 
   465 
   466 101
   466 101
   467 00:05:09,860 --> 00:05:12,110
   467 00:05:09,860 --> 00:05:12,110
   468 then we can match
   468 then we can match
   473 When can this regular expression
   473 When can this regular expression
   474 match the empty string?
   474 match the empty string?
   475 
   475 
   476 103
   476 103
   477 00:05:14,870 --> 00:05:16,265
   477 00:05:14,870 --> 00:05:16,265
   478 So these are now two copies of
   478 So these are now two copies of r.
   479 
   479 
   480 104
   480 104
   481 00:05:16,265 --> 00:05:20,690
   481 00:05:16,265 --> 00:05:20,690
   482 our well-posed copies need
   482 Well, both copies need
   483 to match the empty string.
   483 to match the empty string.
   484 
   484 
   485 105
   485 105
   486 00:05:20,690 --> 00:05:22,820
   486 00:05:20,690 --> 00:05:22,820
   487 So again, we have to ask
   487 So again, we have to ask
   490 00:05:22,820 --> 00:05:25,774
   490 00:05:22,820 --> 00:05:25,774
   491 both of them need to be nullable.
   491 both of them need to be nullable.
   492 
   492 
   493 107
   493 107
   494 00:05:25,774 --> 00:05:28,520
   494 00:05:25,774 --> 00:05:28,520
   495 Ok? Similarly, in the third case,
   495 Similarly, in the third case,
   496 
   496 
   497 108
   497 108
   498 00:05:28,520 --> 00:05:30,710
   498 00:05:28,520 --> 00:05:30,710
   499 all three copies need to be
   499 all three copies need to be
   500 
   500 
   501 109
   501 109
   502 00:05:30,710 --> 00:05:33,230
   502 00:05:30,710 --> 00:05:33,230
   503 able to match the empty
   503 able to match the empty
   504 string. Men, is that the case?
   504 string. When is that the case?
   505 
   505 
   506 110
   506 110
   507 00:05:33,230 --> 00:05:38,360
   507 00:05:33,230 --> 00:05:38,360
   508 Well, if nullable of
   508 Well, if nullable of
   509 our holes and so on.
   509 r holds and so on.
   510 
   510 
   511 111
   511 111
   512 00:05:38,360 --> 00:05:48,754
   512 00:05:38,360 --> 00:05:48,754
   513 So we can actually define that
   513 So we can actually define that
   514 if n equals 0, then true.
   514 if n = 0, then true,
   515 
   515 
   516 112
   516 112
   517 00:05:48,754 --> 00:05:56,045
   517 00:05:48,754 --> 00:05:56,045
   518 Else we have to ask with
   518 else we have to ask whether
   519 nullable of our holes.
   519 nullable of r holds.
   520 
   520 
   521 113
   521 113
   522 00:05:56,045 --> 00:05:58,550
   522 00:05:56,045 --> 00:05:58,550
   523 So that will be the clause we
   523 So that will be the clause we
   524 
   524 
   525 114
   525 114
   526 00:05:58,550 --> 00:06:01,625
   526 00:05:58,550 --> 00:06:01,625
   527 have to implement for
   527 have to implement for
   528 n times and nullable.
   528 n-times and nullable.
   529 
   529 
   530 115
   530 115
   531 00:06:01,625 --> 00:06:04,280
   531 00:06:01,625 --> 00:06:04,280
   532 Deriving the definition for
   532 Deriving the definition for
   533 
   533 
   534 116
   534 116
   535 00:06:04,280 --> 00:06:06,920
   535 00:06:04,280 --> 00:06:06,920
   536 the derivative of the n terms
   536 the derivative of the n-times
   537 
   537 
   538 117
   538 117
   539 00:06:06,920 --> 00:06:10,175
   539 00:06:06,920 --> 00:06:10,175
   540 reg expression.
   540 regular expression
   541 It's not that easy.
   541 is not that easy.
   542 
   542 
   543 118
   543 118
   544 00:06:10,175 --> 00:06:12,755
   544 00:06:10,175 --> 00:06:12,755
   545 So we have to look again
   545 We have to look again
   546 how it was defined
   546 how it was defined
   547 
   547 
   548 119
   548 119
   549 00:06:12,755 --> 00:06:16,010
   549 00:06:12,755 --> 00:06:16,010
   550 earlier and we somehow
   550 earlier and we somehow
   551 have to spot a pattern.
   551 have to spot a pattern.
   552 
   552 
   553 120
   553 120
   554 00:06:16,010 --> 00:06:18,380
   554 00:06:16,010 --> 00:06:18,380
   555 The voice, our
   555 Otherwise, our
   556 algorithm will be again
   556 algorithm will be again
   557 
   557 
   558 121
   558 121
   559 00:06:18,380 --> 00:06:20,975
   559 00:06:18,380 --> 00:06:20,975
   560 quite slow if you don't
   560 quite slow if we don't
   561 spot that pattern.
   561 spot that pattern.
   562 
   562 
   563 122
   563 122
   564 00:06:20,975 --> 00:06:22,550
   564 00:06:20,975 --> 00:06:22,550
   565 So let's have a look.
   565 So let's have a look.
   569 So in the case that
   569 So in the case that
   570 n is equal to 0,
   570 n is equal to 0,
   571 
   571 
   572 124
   572 124
   573 00:06:26,240 --> 00:06:29,885
   573 00:06:26,240 --> 00:06:29,885
   574 then r n times most
   574 then r n-times was
   575 defined as just one.
   575 defined as just 1.
   576 
   576 
   577 125
   577 125
   578 00:06:29,885 --> 00:06:32,030
   578 00:06:29,885 --> 00:06:32,030
   579 What would be the
   579 What would be the
   580 derivative of one?
   580 derivative of one?