[User] Please transcribe this text

[Assistant] Shirley Temple and Elvis were both aloha shirt ambassadors.


[User] Please transcribe this text

[Assistant] Welcome to the store with the world's largest aloha shirt collection, Bailey's Antiques.


[User] Please transcribe this text

[Assistant] Bailey's Antiques began selling aloha shirts in 1980 and has a collection of over 15,000 shirts. There are newer style shirts that sell for $9 to $19, remake shirts that sell for $25 to $59, and, hanging from the ceiling, expensive vintage shirts from the 1930s, 40s, and 50s.


[User] Please transcribe this text

[Assistant] As the owner already mentioned, there are more aloha shirts here than anywhere else in the world.


[User] Please transcribe this text

[Assistant] I ran a virus scan on your computer and it turns out that you have a lot of infected files. But I'm quite careful when I'm browsing the internet. I have no idea how I could have picked up a virus.


[User] Please transcribe this text

[Assistant] Well, you have to make sure their anti-virus software is updated regularly. Yours wasn't up to date. That's probably what was causing your problems. Okay, anything else? Yeah, try not to kick or hit the computer. Uhm, yeah, sorry about that.


[User] Please transcribe this text

[Assistant] I ran a virus scan on your computer and it turns out that you have a lot of infected files.


[User] Please transcribe this text

[Assistant] But I'm quite careful when I'm browsing the internet. I have no idea how I could have picked up a virus. Well, you have to make sure that your anti-virus software is updated regularly. Yours wasn't up to date. That's probably what was causing your problems. Okay. Anything else?


[User] Please transcribe this text

[Assistant] Yeah, try not to kick or hit the computer. Uhm, yeah. Sorry about that.


[User] Please transcribe this text

[Assistant] I ran a virus scan on your computer and it turns out that you have a lot of infected files. But I'm quite careful when I'm browsing the internet. I have no idea how I could have picked up a virus.


[User] Please transcribe this text

[Assistant] Well, you have to make sure their anti-virus software is updated regularly. Yours wasn't up to date. That's probably what was causing your problems. Okay, anything else?


[User] Please transcribe this text

[Assistant] Yeah, try not to kick or hit the computer. Uhm, yeah, sorry about that.


[User] Please transcribe this text

[Assistant] Hello and welcome to this new series on data structures.


[User] Please transcribe this text

[Assistant] In these first few videos, I want to lay the foundation of some core concepts you will need throughout these video tutorials. Let's get started with the basics. So what is a data structure?


[User] Please transcribe this text

[Assistant] One definition that I really like is


[User] Please transcribe this text

[Assistant] A data structure is a way of organizing data so that it can be used efficiently.


[User] Please transcribe this text

[Assistant] And that's all a data structure really is. It is a way of organizing data in some fashion so that later on, it can be accessed, queried, or perhaps even updated quickly and easily.


[User] Please transcribe this text

[Assistant] Well they are essential ingredients in creating fast and powerful algorithms. Another good reason might be that they help us manage and organize our data in a very natural way.


[User] Please transcribe this text

[Assistant] And this last point is more of my own making and it's that it makes code cleaner and easier to understand.


[User] Please transcribe this text

[Assistant] As a side note, one of the major distinctions that I have noticed from bad mediocre to excellent programmers is that the ones who really excel are the ones who fundamentally understand how and when to use the appropriate data structure for the task they're trying to finish.


[User] Please transcribe this text

[Assistant] Data structures can make the difference between having an okay product and an outstanding one. It's no wonder that every computer science undergraduate student is required to take a course in data structures.


[User] Please transcribe this text

[Assistant] It is strange that before we even begin talking about data structures that we need to talk about the abstraction of data structures, what I'm talking about is the concept of an abstract data type.


[User] Please transcribe this text

[Assistant] What is an abstract data type and how does it differ from a data structure?


[User] Please transcribe this text

[Assistant] Well, the answer is that an abstract data type is an abstraction of a data structure which provides only the interface to which that data structure must adhere to.


[User] Please transcribe this text

[Assistant] The interface does not give any specific details on how a specific data structure should be implemented or in what programming language.


[User] Please transcribe this text

[Assistant] One particular example I like to give is to suppose that your abstract data type is for a mode of transportation to get from point A to point B.


[User] Please transcribe this text

[Assistant] Well, as we both know, there are many modes of transportation to get from one place to another. So which one do you choose?


[User] Please transcribe this text

[Assistant] Some specific modes of transportation might be walking or biking, perhaps even taking a train and so on. These specific modes of transportation would be analogous to the data structures themselves. We want to get from one place to another


[User] Please transcribe this text

[Assistant] Through some mode of transportation that was our abstract data type. How did we do that exactly? Well, that is the data structure.


[User] Please transcribe this text

[Assistant] Here are some examples of abstract data types on the left and some possible underlying implementation on the right hand side.


[User] Please transcribe this text

[Assistant] As you can see, a list can be implemented in two ways. You can have a dynamic array or linked list. They both provide ways of adding, removing and indexing elements in the list.


[User] Please transcribe this text

[Assistant] Next, we have a queue and the map abstract data types, which themselves can be implemented in a variety of ways. Notice that under the implementation for a queue, I put a stack based queue because yes, you can have a queue, which is implemented using only stacks.


[User] Please transcribe this text

[Assistant] But it does work and it is possible. The point here is that the abstract data type only defines how a data structure should behave and what methods it should have, but not the details surrounding how those methods are implemented.


[User] Please transcribe this text

[Assistant] That is all for this video. Thank you for watching. And in the next video, we will be talking about computational complexity and big O notation. See you then.


[User] Please transcribe this text

[Assistant] There was a mix-up at the airport and my bags were sent to Antarctica.


[User] Please transcribe this text

[Assistant] This is part one of two. In the second part, we will be looking at some source code on how to implement a doubly linked list. So for today's outline,


[User] Please transcribe this text

[Assistant] In the first section, we're going to answer some basic questions concerning singly and doubly linked lists, namely, what are they? And where are they used? Next, we'll cover some terminology concerning the link list. So everyone knows what I mean when I say the head of the link list versus the tail of the link list.


[User] Please transcribe this text

[Assistant] Then last in the discussion, we'll talk about the pros and cons of using singly and doubly linked lists.


[User] Please transcribe this text

[Assistant] Then how to insert and remove elements from both singly and doubly linkless as well as some source code. So stay tuned. All right discussion.


[User] Please transcribe this text

[Assistant] So what is a linked list linked list is a sequential list of nodes that hold data which point to other nodes also containing data.


[User] Please transcribe this text

[Assistant] Notice that every node has a pointer to the next node. Also notice that the last node points to null.


[User] Please transcribe this text

[Assistant] For simplicity, I will omit this in the following slides. Okay, so where are lengthless use?


[User] Please transcribe this text

[Assistant] One of the places that get used the most is actually in the abstract data type implementation of lists, stacks and queues because of their great time complexity for adding and removing elements.


[User] Please transcribe this text

[Assistant] Making the pointer of the last node points to the first node.


[User] Please transcribe this text

[Assistant] So circular linked lists are used to model repeating event cycles, maybe like having a round robin ordering on a bunch of elements or representing corners of a polygon. So definitely a lot of uses there.


[User] Please transcribe this text

[Assistant] Linkless can also be used to model real world objects such as a line of train carts that could be useful.


[User] Please transcribe this text

[Assistant] And moving on to some more advanced examples, we also heavily use linked lists and hash table separate chaining.


[User] Please transcribe this text

[Assistant] This is because we need somewhere to start when traversing our


[User] Please transcribe this text

[Assistant] Then there are also the nodes themselves, which contain pointers, pointers are also sometimes called references. And these pointers always point the next node.


[User] Please transcribe this text

[Assistant] You should also know that the nodes themselves are usually represented as structs or classes when actually implemented. We'll get to this when we look at the source code. Okay, singly versus doubly linked lists.


[User] Please transcribe this text

[Assistant] So concerning the kinds of linked lists that there are, there are two types singly linked and doubly linked.


[User] Please transcribe this text

[Assistant] Singly linked lists only contain a pointer to the next node while doubly linked lists not only contain a pointer the next node, but also to the previous node, which makes it quite useful sometimes.


[User] Please transcribe this text

[Assistant] This is not to say we cannot have triple E or quadruple E length lists, I just wouldn't know where to place additional pointers.


[User] Please transcribe this text

[Assistant] If we look at the singly linked list, we observe that it uses less memory. Why? Well,


[User] Please transcribe this text

[Assistant] Pointers to nodes can actually take up a lot of memory. If you're running on a 64 bit machine references use


[User] Please transcribe this text

[Assistant] 8 bytes. On a 32 bit machine, 4 bytes each.


[User] Please transcribe this text

[Assistant] So having a singly linked list means you only need one pointer for each node, hence twice as much memory is saved. A downside, however,


[User] Please transcribe this text

[Assistant] Is that you cannot access previous elements because you don't have access to them.


[User] Please transcribe this text

[Assistant] Now concerning doubly linked lists, well, a great pro is that having access to the tail, we can easily traverse the list backwards, something we can't do with a singly linked list.


[User] Please transcribe this text

[Assistant] Also having a reference to node you want to remove, you can remove it in constant time and patch the hole you just created.


[User] Please transcribe this text

[Assistant] Because you have, again, access to both the previous and the next notes. This is something you cannot do with a singly linked list. You would leave the list severed in two. A downside to the doubly linked list is it does use up twice as much memory.


[User] Please transcribe this text

[Assistant] Now we want to insert 11 at the third position where seven is currently let's walk through an example.


[User] Please transcribe this text

[Assistant] This is almost always the first step in all linkless operations.


[User] Please transcribe this text

[Assistant] Remember, we have access to 23 is next pointer because we have a reference to it with the traverser.


[User] Please transcribe this text

[Assistant] Correctly inserted 11 at the right position and we're done.


[User] Please transcribe this text

[Assistant] Not only has pointers to the next node, but also to the previous node, we also have to change those in the insertion phase.


[User] Please transcribe this text

[Assistant] Okay, create a traverser pointer, which points to where the head is and advance it until you are just before the insertion position.


[User] Please transcribe this text

[Assistant] We make seven's previous pointer equal to 11. So we can go backwards from seven to 11.


[User] Please transcribe this text

[Assistant] This is so that we can go forwards from 23 to 11. So in total remark that we changed exactly four pointers. So if we flatten out the list, you can see that 11 has been inserted in the correct position.


[User] Please transcribe this text

[Assistant] So suppose we want to remove the node with a value nine. How do we do this? Well, the trick we're going to use is not to use one pointer, but two.


[User] Please transcribe this text

[Assistant] You can use one but for visual effects, it's easier to show you how it is done by using two


[User] Please transcribe this text

[Assistant] So we create pointers, trav one and trap two for traverser one and traversing two respectively. So traverser one points to the head traverser two points to the head's next note. Now we're going to do is advanced trap to


[User] Please transcribe this text

[Assistant] Until we find the node we want to remove while also advancing trap one.


[User] Please transcribe this text

[Assistant] Node nine. So this is the stopping point. I'm going to create another pointer.


[User] Please transcribe this text

[Assistant] Okay, so now I had to have advanced trap to to the next node. And node nine has turned red. I've done this to indicate that this will that at this point, node nine is ready to be removed. I'm just keeping around for the visual effect.


[User] Please transcribe this text

[Assistant] And now is an appropriate time to remove the temporary pointer because doing nothing with it.


[User] Please transcribe this text

[Assistant] And their temp has been deallocated. Make sure you always clean up your memory to avoid memory leaks. This is especially important in C and C++.


[User] Please transcribe this text

[Assistant] And other programming languages where you manage your memory. Now you can see that nine is gone. And our singly linked list is shorter.


[User] Please transcribe this text

[Assistant] But this time, we only need one pointer. I mean, one traverser pointer, because each known the singly linked list


[User] Please transcribe this text

[Assistant] We have access to four and 15 because they are Travis, previous and next pointer respectively.


[User] Please transcribe this text

[Assistant] Notice that trap is now red, meaning it is ready to be removed.


[User] Please transcribe this text

[Assistant] On the left column we have singly linked lists and on the right doubly linked lists. The complexity for searching


[User] Please transcribe this text

[Assistant] In a linked list is linear, in the worst case, because if the element we're looking for is not there, we have to traverse all of the n elements.


[User] Please transcribe this text

[Assistant] Inserting at the head, though, is constant time, because we always maintain a pointer to the head


[User] Please transcribe this text

[Assistant] To remove the head of a singly linked list and a doubly linked list is also constant time. Again, because we have a reference to it. So we can just remove it and advanced the head by one.


[User] Please transcribe this text

[Assistant] Well, even if we do have a reference to the tail and a singly linked list, we can remove it but only once because we can't reset the value of what the tail is.


[User] Please transcribe this text

[Assistant] A pointer to the previous node, so we can continually remove nodes from the tail.


[User] Please transcribe this text

[Assistant] And finally, removing somewhere in the middle is also linear time because in the worst case,


[User] Please transcribe this text

[Assistant] Also, if you want the source code for the doubly linked lists,


[User] Please transcribe this text

[Assistant] In the next video, have a look at the code repo provided below. It contains all the data structures I will be covering in this series. Guys, thanks for watching. I will see you in the next video.


[User] Please transcribe this text

[Assistant] I know, but I forgot to go to the bathroom before we left.


[User] Please transcribe this text

[Assistant] I know, but I forgot to go to the bathroom before we left.


[User] Please transcribe this text

[Assistant] Okay. Based on their answers, you will decide which of these two activities is more interesting. Then go forth and experience it.


[User] Please transcribe this text

[Assistant] It looks one way, but then hearing their experience, it seemed like they really enjoyed themselves after all was said and done. So I think...


[User] Please transcribe this text

[Assistant] What was that like? Because it was so incredible watching you jump.


[User] Please transcribe this text

[Assistant] So, Andy, how are you feeling right now? I'm still feeling a little out of breath, uhm, but ultimately,


[User] Please transcribe this text

[Assistant] I'm really happy that I did it. I really was so close to just saying no, but...


[User] Please transcribe this text

[Assistant] Having you up there and having Patrick up there, I knew I could not back down.


[User] Please transcribe this text

[Assistant] Really? Do you want to? Yes! Well, I secretly wanted to when I spoke to the two ladies who did it. It looked so fun, but the bungee looked a little more adventurous, so I did that. So I get to do this thing right now?


[User] Please transcribe this text

[Assistant] Oh my gosh. Okay, now I'm scared all over again. I thought I was done for the day. So should I just head over? Take your time. Okay, so maybe I'll just hang out, call my dad, tell him I'm okay.


[User] Please transcribe this text

[Assistant] Welcome back. Today we're going to talk about turning min priority queues into max priority queues. This is part two of five in the priority queue series.


[User] Please transcribe this text

[Assistant] Well, here's the problem. Often in the standard library of most programming languages, they will only provide you with either a max priority queue or a min priority queue. Usually it's a min priority queue, which sorts elements


[User] Please transcribe this text

[Assistant] By the smallest element first, but sometimes we need the max priority queue depending on what we're programming.


[User] Please transcribe this text

[Assistant] So how do we do this? How do we convert one part, one type priority queue into another type?


[User] Please transcribe this text

[Assistant] Well, a hack we can use is to abuse the fact that all elements in a priority queue must implement some sort of comparable interface, which we can simply negate


[User] Please transcribe this text

[Assistant] Or invert to get the other type of heap.


[User] Please transcribe this text

[Assistant] Suppose for a moment that we have a priority queue consisting of elements that are on the right side of this screen. And that these are in that min priority queue.


[User] Please transcribe this text

[Assistant] So if x and y are numbers in the priority queue, and x is less than or equal to y, then x will come out of the priority queue before y.


[User] Please transcribe this text

[Assistant] The negation of this is x is greater than or equal to y. And so y then comes out before


[User] Please transcribe this text

[Assistant] x, because all these elements are still in the priority queue.


[User] Please transcribe this text

[Assistant] Wait a moment you say, isn't the negation of x is less than or equal to y just x greater than y?


[User] Please transcribe this text

[Assistant] And not x is greater than or equal to y. Well, not for comparators.


[User] Please transcribe this text

[Assistant] You see if x is equal to y, whether or not the comparator is negated, x should still equal y.


[User] Please transcribe this text

[Assistant] So now let's see what happens when we pull all these elements out of the priority queue with our negated comparator.


[User] Please transcribe this text

[Assistant] So first we would get 13 because it's the greatest and next comes 11, seven, five, three and two.


[User] Please transcribe this text

[Assistant] An alternative method for numbers is to negate the number before you insert it and negate it again when it comes out. This is a hack


[User] Please transcribe this text

[Assistant] specific to numbers, but it's pretty nice. So let's see how that works.


[User] Please transcribe this text

[Assistant] So let's negate all the numbers inside our priority queue. And now we can see that definitely minus 13 is the smallest, so it should come out first.


[User] Please transcribe this text

[Assistant] So minus 13 indeed comes out first.


[User] Please transcribe this text

[Assistant] But now we have to renegade it and we get 13. Everything is good so far. Next is minus 11. So really positive 11. And so on minus seven, seven, and so on just so


[User] Please transcribe this text

[Assistant] Keep pulling and then renegade the value to get it out of the priority queue. It's a pretty neat hack.


[User] Please transcribe this text

[Assistant] Okay, now let's look at another examples using strings.


[User] Please transcribe this text

[Assistant] So suppose Lex is a comparator for strings, which sorts strings in lexicographic order, this is the default for most programming languages, then let's call n Lex be the negation of Lex.


[User] Please transcribe this text

[Assistant] Our comparator assigns minus one if s one is less than s two x graphically zero, so equal x graphically and plus one if s one is greater than s two x graphically.


[User] Please transcribe this text

[Assistant] But we're interested in negating like so that longer strings appear before shorter strings and also that strings with letters at the end of the alphabet appear before those containing letters at the beginning of the alphabet. I think I said that right.


[User] Please transcribe this text

[Assistant] This was in effect turn a min heap into a max heap. Let's look at a concrete example. So by adding


[User] Please transcribe this text

[Assistant] All the numbers on the right to our prior queue with the lexicographic comparator. Here's the ordering we should expect. First, we get a because it's the shortest string


[User] Please transcribe this text

[Assistant] That has characters appearing closer, closest to the start of the alphabet, then it comes out B, then FZ, then X, then XR and XX.


[User] Please transcribe this text

[Assistant] So now let's do the same thing with n likes. And we should hopefully obtain the opposite sequence in reverse order.


[User] Please transcribe this text

[Assistant] So that's all there is to converting min heaps to max heaps or max heaps and min heaps vice versa. You guys are now pros. You're awesome.


[User] Please transcribe this text

[Assistant] Also, if you're interested in the source code implementation for priority queue, check out the link below on the bottom of the screen. I should also have a link in the description to the GitHub repo with all these data structures. Guys, thanks for watching. I'll catch you next time.


[User] Please transcribe this text

[Assistant] We can construct just about any data structure. So an outline for today's


[User] Please transcribe this text

[Assistant] First, we're going to begin by having a discussion about arrays and answer some fundamental


[User] Please transcribe this text

[Assistant] Questions such as what, where and how are always used.


[User] Please transcribe this text

[Assistant] Lastly, we will go over some complexity analysis.


[User] Please transcribe this text

[Assistant] And look at some source code on how to construct a dynamic array using only static arrays, discussion and examples. So what is a static array?


[User] Please transcribe this text

[Assistant] So static array is a fixed length container containing n elements, which are indexable, usually on the range of zero inclusive to n minus one also inclusive.


[User] Please transcribe this text

[Assistant] So a follow up question is, what is meant by being indexable? So answer this is this means that


[User] Please transcribe this text

[Assistant] Furthermore, I would like to add that static arrays are given as contiguous chunks of memory,


[User] Please transcribe this text

[Assistant] Your chunk of memory doesn't look like a piece of Swiss cheese with a bunch of holes and gaps. It's contiguous, all the addresses are adjacent in your static array.


[User] Please transcribe this text

[Assistant] So of course, the first simple example is to temporarily store objects, this most common use of arrays that you are probably familiar with.


[User] Please transcribe this text

[Assistant] That you need to process, but that file is so big it doesn't fit in all in memory.


[User] Please transcribe this text

[Assistant] So we use a buffer to read small chunks of the file into the buffer.


[User] Please transcribe this text

[Assistant] Or the array one at a time and so eventually we're able to read the entire file.


[User] Please transcribe this text

[Assistant] I also like to use arrays as lookup tables because of their indexing property. So this is a really easy way to retrieve data from a lookup table if you know where everything is supposed to be and at what offset.


[User] Please transcribe this text

[Assistant] With tabulation to cache already computed sub problems. So a classic example of this might be the knapsack problem or the coin change problem. All right, time to talk about some complexity.


[User] Please transcribe this text

[Assistant] So the access time for static array and a dynamic array is constant because of the property that arrays are indexable.


[User] Please transcribe this text

[Assistant] Searching however can take up to linear time because we potentially have to traverse all the elements.


[User] Please transcribe this text

[Assistant] In the array in the worst case such as if the element you're looking for does not exist.


[User] Please transcribe this text

[Assistant] The static array is a fixed size container. It cannot grow larger or smaller.


[User] Please transcribe this text

[Assistant] And recopy all the elements into the new static array. This is assuming we're implementing a dynamic array using static arrays, however.


[User] Please transcribe this text

[Assistant] The very first element 44 has index of position zero in the array.


[User] Please transcribe this text

[Assistant] Not one, this confuses many, many intro computer science students, you have no idea. The confusing part is that most


[User] Please transcribe this text

[Assistant] If not all of mathematics is one based while computer science is one.


[User] Please transcribe this text

[Assistant] But worst of all is quantum computing. I did research one summer in quantum computing during my undergrad. And the field is a mess. It tries to please mathematicians, computer scientists, and physicists all at the same time. And indexing just doesn't work well. Anyways, back to our race.


[User] Please transcribe this text

[Assistant] For each loop, something that's offered in some programming languages, it doesn't require you to explicitly reference the indices of your array, although the indexing is done internally behind the scenes.


[User] Please transcribe this text

[Assistant] The notation of the square brackets denotes indexing. So array a


[User] Please transcribe this text

[Assistant] Square bracket zero, closed square bracket is equal to 44, meaning a at position zero


[User] Please transcribe this text

[Assistant] Is equal to the value 44. Similarly, a at position one is 12 a, four, six, a at seven is nine. But


[User] Please transcribe this text

[Assistant] A at index 9 is out of bounds, and our program will throw an exception.


[User] Please transcribe this text

[Assistant] Unless you're in C, it doesn't always throw an exception. Unfortunately. Okay.


[User] Please transcribe this text

[Assistant] So the dynamic array can do all similar get set operation static arrays can do but unlike the static array, it grows inside as dynamically as needed. So if we have a containing 34 and four, then if we add minus seven, it gets appended to the end. If we add 34 again, then it'll add it to the end.


[User] Please transcribe this text

[Assistant] We already talked about this a little bit, but how do we formally implement a dynamic array?


[User] Please transcribe this text

[Assistant] So first we create a stack array with some initial capacity usually non zero.


[User] Please transcribe this text

[Assistant] So as we add elements, we add elements to the underlying static array, keeping track number elements added once


[User] Please transcribe this text

[Assistant] What we can do is we can double the size, copy all the elements into this new static array, and add the new element we need to add. Let's see an example. So suppose we create a dynamic array with an initial capacity of two.


[User] Please transcribe this text

[Assistant] Then we begin adding elements to it. So the little circle with the slash through it is a placeholder for an empty position. Okay, so we add seven, everything's fine. We add nine, everything's fine. But once we add three,


[User] Please transcribe this text

[Assistant] It doesn't fit in our internal stack array. So we double the size of the array, copy all the elements in. And now we can add three. Now if we add 12, everything's still okay, we're doing good.


[User] Please transcribe this text

[Assistant] And if we add five, okay, we have to do a resize again. So double the size of the container, copy all the elements into this new larger array, and then finish off by adding five. And similarly, we can add six without any issues.


[User] Please transcribe this text

[Assistant] Okay, so I will be showing you an implementation of a dynamic array in the next video.


[User] Please transcribe this text

[Assistant] If you're interested in the source code, it can be found at the link below. The link should also be provided in the description. So guys, thanks for watching, and hopefully I will catch you in the next video.


[User] Please transcribe this text

[Assistant] Kevin went on three different rides and had his heart rate measured after each one. What willing rides are awaiting him next?


[User] Please transcribe this text

[Assistant] A trickle of fecal pellets and dead organic material that drifts downwards from the surface waters.


[User] Please transcribe this text

[Assistant] Where photosynthetic primary productivity is possible.


[User] Please transcribe this text

[Assistant] Levels of ambient light from the sun are too low for photosynthesis to occur.


[User] Please transcribe this text

[Assistant] And at around 1000 metres, aside from the infrequent twinkling of bioluminescence,


[User] Please transcribe this text

[Assistant] The ocean is drowned in pure darkness.


[User] Please transcribe this text

[Assistant] Without photosynthesis, the supply of scraps are all that remain to nourish any life.


[User] Please transcribe this text

[Assistant] However, on the deep sea floor, there are important regions where primary production is possible.


[User] Please transcribe this text

[Assistant] These are the chemosynthetic oases of the deep sea.


[User] Please transcribe this text

[Assistant] Which represent some of the only locations on Earth where the ultimate source of energy for life is not sunlight, but the Earth itself.


[User] Please transcribe this text

[Assistant] In this series of films, we'll delve into their formation and ecology, as well as the threats they face.


[User] Please transcribe this text

[Assistant] And the importance of stewardship for these fascinating environments.


[User] Please transcribe this text

[Assistant] The process of chemosynthesis is similar to photosynthesis.


[User] Please transcribe this text

[Assistant] Primary production is fuelled by chemical energy, rather than energy from the sun.


[User] Please transcribe this text

[Assistant] But this can only take place at certain seafloor environments.


[User] Please transcribe this text

[Assistant] The two main examples of such environments are hydrothermal vents and cold seeps.


[User] Please transcribe this text

[Assistant] The former were only discovered in 1977, when scientists were exploring an oceanic spreading ridge near the Galapagos Islands. What they discovered


[User] Please transcribe this text

[Assistant] Since then, hundreds more vent fields have been discovered, often at depths of 2km or more, along Earth's convergent plate boundaries.


[User] Please transcribe this text

[Assistant] And at seafloor spreading regions where the oceanic crust is moving apart.


[User] Please transcribe this text

[Assistant] Where the fast spreading rates have created vent fields dotted along the ridge, tens of kilometers apart.


[User] Please transcribe this text

[Assistant] In contrast, the vent fields of the much slower spreading mid-Atlantic ridge may be hundreds of kilometres apart.


[User] Please transcribe this text

[Assistant] They form here because the rifting of tectonic plates creates fissures in the crust and allows hot magma from deep within the earth to rise closer to the seabed.


[User] Please transcribe this text

[Assistant] Upper parts of the sea floor are very permeable. Cold seawater enters.


[User] Please transcribe this text

[Assistant] And percolates down through the crust where it becomes superheated, and takes up minerals from the surrounding rocks.


[User] Please transcribe this text

[Assistant] This mineral-rich fluid then jets back into the ocean at extremely high velocities, and temperatures exceeding 400 degrees Celsius. As the fluids mix with cold seawater,


[User] Please transcribe this text

[Assistant] The dissolved minerals precipitate out in smoke-like billows.


[User] Please transcribe this text

[Assistant] And build towering chimney structures on the seafloor.


[User] Please transcribe this text

[Assistant] There are a few varieties of hydrothermal vent, characterised by the specific mineral content of the vent fluid.


[User] Please transcribe this text

[Assistant] Black smokers amid the hottest, darkest plumes.


[User] Please transcribe this text

[Assistant] With high levels of sulphides that precipitate on contact with the cold ocean to form the black smoke.


[User] Please transcribe this text

[Assistant] In contrast, white smokers contain barium, calcium, and silicon.


[User] Please transcribe this text

[Assistant] Other vents may be characterized simply by shimmering streams of water.


[User] Please transcribe this text

[Assistant] There is a very sharp temperature gradient between the fluid and the surrounding seawater.


[User] Please transcribe this text

[Assistant] Across a distance of around 10 centimeters, temperatures can drop from over 300 degrees to just 2 degrees celsius.


[User] Please transcribe this text

[Assistant] Most vent animals live at far cooler temperatures.


[User] Please transcribe this text

[Assistant] But prokaryotic microbes, including forms of both archaea and bacteria, are able to tolerate fluids as hot as 122 degrees Celsius.


[User] Please transcribe this text

[Assistant] Here, they carry out chemosynthesis via a number of different pathways that depend on the specific conditions of their microenvironment and the chemicals that are present.


[User] Please transcribe this text

[Assistant] Typically, they use energy stored in the chemical bonds of hydrogen sulfide and methane to create glucose from water and dissolved carbon dioxide.


[User] Please transcribe this text

[Assistant] The result of this chemosynthetic primary productivity is the presence of vast assemblages of animal life, concentrated at these regions.


[User] Please transcribe this text

[Assistant] The supply of nutrients forms the basis of a food web, for a diverse community of specialized organisms.


[User] Please transcribe this text

[Assistant] You only have to compare the life of hydrothermal vents with non-chemosynthetic deep-sea environments.


[User] Please transcribe this text

[Assistant] Out on the abyssal plain, life is present but scattered.


[User] Please transcribe this text

[Assistant] But at the vents, the chimneys are encased with dense colonies of rust-coloured snails, swarms of deep-sea shrimp.


[User] Please transcribe this text

[Assistant] Or expansive aggregations of ghostly white crabs competing for space on the rocks.


[User] Please transcribe this text

[Assistant] Remarkably, these varied and abundant species are all sharing a single resource.


[User] Please transcribe this text

[Assistant] They all rely on the chemosynthetic microbes as a source of food.


[User] Please transcribe this text

[Assistant] Meaning vents are sites of significant interspecific competition.


[User] Please transcribe this text

[Assistant] That is, competition between members of different species.


[User] Please transcribe this text

[Assistant] Often, interspecific competition can lead to the extinction of one or more of the species competing.


[User] Please transcribe this text

[Assistant] The species that is less suitably adapted may lose out on the resources it requires and become out-competed.


[User] Please transcribe this text

[Assistant] The idea that in a stable ecosystem, no two species can have exactly the same niche and stably coexist is known as the competitive exclusion principle.


[User] Please transcribe this text

[Assistant] It allows the species to coexist because there is less direct competition between them.


[User] Please transcribe this text

[Assistant] The competing crabs, worms, and shrimps may all be in pursuit of the same resources, but they have developed very different ways of acquiring them.


[User] Please transcribe this text

[Assistant] We also find suspension feeders, like deep sea mussels, feeding on free living microbes that are suspended in the water.


[User] Please transcribe this text

[Assistant] Yeti crabs farm the bacteria in filamentous hair-like colonies on their bodies.


[User] Please transcribe this text

[Assistant] The crabs are able to move around and take the bacteria with them.


[User] Please transcribe this text

[Assistant] Meaning they are fixed in one place and cannot move.


[User] Please transcribe this text

[Assistant] Their competitive advantage arises from their ability to form an endosymbiotic relationship with the microbes.


[User] Please transcribe this text

[Assistant] They store them within their tubes, effectively holding them captive and benefiting from the nutrients they produce.


[User] Please transcribe this text

[Assistant] The bacteria provide the carbon that the tube worms require in order to live.


[User] Please transcribe this text

[Assistant] It is also thought that the bacteria benefit by being sheltered within the tube worms, and are therefore protected from predatory grazers like limpets and crabs.


[User] Please transcribe this text

[Assistant] Another denizen of deep sea vents, the Pompei worm.


[User] Please transcribe this text

[Assistant] Farms bacterial colonies in a similar fashion to yeti crabs.


[User] Please transcribe this text

[Assistant] But its higher thermal tolerance allows it to inhabit locations on the vent structures that are far hotter than those that the crabs can endure.


[User] Please transcribe this text

[Assistant] Here, they dwell within U-shaped tubes, which can reach temperatures up to 80 degrees Celsius.


[User] Please transcribe this text

[Assistant] Thus, much like we see with creatures of the rocky intertidal zone,


[User] Please transcribe this text

[Assistant] There is zonation here between different animal species.


[User] Please transcribe this text

[Assistant] Which occurs due to the presence of a temperature gradient, and varying abundances of different microbe varieties.


[User] Please transcribe this text

[Assistant] The worms and crabs have become geographically isolated from one another within the same vent system.


[User] Please transcribe this text

[Assistant] All the creatures we've discussed so far can be classed as primary consumers.


[User] Please transcribe this text

[Assistant] Along with white zooarchid fish, which feed on the tube worms and shrimps.


[User] Please transcribe this text

[Assistant] Some deep sea skates, which tend to dwell along the continental slope, visit hydrothermal vents to feed, but also to lay their eggs.


[User] Please transcribe this text

[Assistant] The zonation of life at vents leads to a higher abundance of filter feeders and predators in the periphery, further from the chimneys.


[User] Please transcribe this text

[Assistant] Animals like stalked barnacles and predatory anemones are less tolerant of the chemical-rich, low-oxygen conditions found closer to the fluids. But they can still make a living here.


[User] Please transcribe this text

[Assistant] We find non-vent deep sea fauna existing on the abyssal plain near the vent systems at higher abundances than they're typically found.


[User] Please transcribe this text

[Assistant] Over 590 animal species have been identified living at hydrothermal vents.


[User] Please transcribe this text

[Assistant] And a surprising majority of these organisms are unique to this environment.


[User] Please transcribe this text

[Assistant] There is substantial evidence to suggest this may be the case.


[User] Please transcribe this text

[Assistant] Firstly, some of the thermophilic or heat-loving vent microbes are among the most primitive organisms known on Earth.


[User] Please transcribe this text

[Assistant] Evidence is also given by the fact that many of the chemical building blocks of life are found at the fence, suggesting that the precursors of life


[User] Please transcribe this text

[Assistant] To create complex organic molecules, such as amino acids and nucleotides.


[User] Please transcribe this text

[Assistant] Along continental margins and down in oceanic trenches, we find cold seeps.


[User] Please transcribe this text

[Assistant] And provides the necessary conditions for chemosynthetic assemblages to form.


[User] Please transcribe this text

[Assistant] These mirror event systems in a number of ways.


[User] Please transcribe this text

[Assistant] But they give rise to an alternative set of conditions for life to adapt to and exploit.


[User] Please transcribe this text

[Assistant] The geological origins of cold seeps differs from hydrothermal vents.


[User] Please transcribe this text

[Assistant] Cold seeps instead arise at the other end of oceanic plates.


[User] Please transcribe this text

[Assistant] Their formation begins with the burial of organic material under sediments on the sea floor. These organic compounds degrade over time, producing methane.


[User] Please transcribe this text

[Assistant] Geological processes like the tectonic compression of sediments at subduction zones forces the methane from deep reservoirs up through the overlying sediments.


[User] Please transcribe this text

[Assistant] Anaerobic microbes dwelling below the sediment's surface.


[User] Please transcribe this text

[Assistant] Oxidise this methane using sulphate, producing hydrogen sulphide and bicarbonate ions as a byproduct.


[User] Please transcribe this text

[Assistant] This hydrogen sulphide, along with any residual methane, then serves as a vital energy source for chemosynthetic microbes.


[User] Please transcribe this text

[Assistant] Thus, it is a consortium of two distinct sets of microbes that makes primary productivity possible at cold seeps, and lays the foundations of food webs here.


[User] Please transcribe this text

[Assistant] The result is an environment remarkably similar to hydrothermal vents.


[User] Please transcribe this text

[Assistant] And an abundance of life exploiting this productivity.


[User] Please transcribe this text

[Assistant] 70% of the Earth's surface is abyssal plane.


[User] Please transcribe this text

[Assistant] You're met with a seafloor region that's booming with life.


[User] Please transcribe this text

[Assistant] Beds of bathymodiolus muscles, endemic to chemosynthetic oases, encase the landscape.


[User] Please transcribe this text

[Assistant] These animals seem to dominate chemosynthetic communities.


[User] Please transcribe this text

[Assistant] Due to their ability to form an endosymbiotic association with the microbes, they host the bacteria within their gills.


[User] Please transcribe this text

[Assistant] Grazers like gastropods and orbinid polychaetes.


[User] Please transcribe this text

[Assistant] As well as scavengers like shrimp and squat lobsters picking at organic detritus produced by the mussels.


[User] Please transcribe this text

[Assistant] Cyboglenid tubeworms, belonging to the same family as the tubeworms of hydrothermal vents, can be found here too. In a similar fashion to vent tubeworms.


[User] Please transcribe this text

[Assistant] But one key difference between tubeworms at vents and seeps.


[User] Please transcribe this text

[Assistant] Hydrothermal vents are located at mid-ocean ridges, where sediment hasn't had time to accumulate on the newly formed oceanic crust.


[User] Please transcribe this text

[Assistant] Cold seep tube worms are able to burrow down into sediments.


[User] Please transcribe this text

[Assistant] And take up sulphide via their roots, rather than just the plumes.


[User] Please transcribe this text

[Assistant] They're even able to establish their extensive root system in the hard carbonate rocks that form at cold seeds.


[User] Please transcribe this text

[Assistant] It's estimated that they may be able to live for over 200 years, forming tube worm bushes, which can contain hundreds of individual worms.


[User] Please transcribe this text

[Assistant] Just like the muscle beds, these bushes create a complex 3D environment that supports a range of other organisms.


[User] Please transcribe this text

[Assistant] Nestled among the cracks and crevices created by the mussel beds, we find another cold-seeped anizen you might recognise from hydrothermal vents.


[User] Please transcribe this text

[Assistant] Although these Yeti crabs are a different species to the ones at Vents, they exhibit a similar trophic adaptation, and farm colonies of bacteria on their bodies as epibionts inhabiting their surface.


[User] Please transcribe this text

[Assistant] These crabs have developed long, hairy, claw-bearing arms, or keeli.


[User] Please transcribe this text

[Assistant] Which they wave directly in the sulphide-rich seepage.


[User] Please transcribe this text

[Assistant] Predatory organisms such as octopuses, fish, and larger crabs are attracted to this vibrant community to complete the food chain.


[User] Please transcribe this text

[Assistant] Incredibly, the abundant life of coal seeps significantly reduces the flux of methane from the sea floor to the water column.


[User] Please transcribe this text

[Assistant] For organisms here represent the only biological methane sink in the ocean. This is called the benthic filter.


[User] Please transcribe this text

[Assistant] At cold seeps with bacterial mats, it's thought that between 50 and 90% of released methane is consumed and taken out of the system.


[User] Please transcribe this text

[Assistant] Variations in the underlying geological processes can give rise to different types of cold-sleep environments.


[User] Please transcribe this text

[Assistant] Often with distinct communities, adapted to the unique abiotic challenges.


[User] Please transcribe this text

[Assistant] Rise from over a kilometer beneath the sea floor, exploding out of the sediment in pulses.


[User] Please transcribe this text

[Assistant] Over time, this builds up mud in the shape of a cone.


[User] Please transcribe this text

[Assistant] But along the borders of mud volcanoes, beyond the region prone to eruption,


[User] Please transcribe this text

[Assistant] We occasionally find bacterial mats and meadows of tube worms thriving on the methane.


[User] Please transcribe this text

[Assistant] Sometimes called methane ice is a frozen form of methane combined with water that forms in high pressure, low temperature conditions, meaning it's stable here at the deep sea floor where it forms mounds.


[User] Please transcribe this text

[Assistant] During their 2017 expedition in the Gulf of Mexico, NOAA's remotely operated vehicle encountered these gas hydrate mounds at depths of around 1,050 metres.


[User] Please transcribe this text

[Assistant] On the outcrops themselves, the only macrofauna identified as living directly on the methane hydrate was a species of polychaete called ice worms.


[User] Please transcribe this text

[Assistant] At only two to four centimetres long, these worms burrow into the hydrate, creating small depressions and survive by grazing on chemosynthetic bacteria that grow on the hydrate surface.


[User] Please transcribe this text

[Assistant] Streams of methane bubbles could be seen rising up towards the surface, sometimes encased in clear tubes of hydrate.


[User] Please transcribe this text

[Assistant] This footage, captured by M. Barry scientists in 2011, shows a deep sea crab mistaking the movement of a stream of methane for food. As it came in contact with the bubbles, the gas solidified.


[User] Please transcribe this text

[Assistant] Scientists discovered that vast areas of the sea floor were covered with swathes of asphalt.


[User] Please transcribe this text

[Assistant] These asphalt seeps formed when petroleum deposits deep beneath the sea floor leaked out into the water.


[User] Please transcribe this text

[Assistant] Lighter components rose up towards the surface.


[User] Please transcribe this text

[Assistant] When explorers from Noah approached the site with their ROV, they stumbled upon an enormous formation, splayed out over the seabed like a flower. Later dubbed a Tar Lily,


[User] Please transcribe this text

[Assistant] Cracks formed, and the lily provided a hard substrate that bacteria could colonise, using the oil for primary production and transforming this extrusion into a localised chemosynthetic paradise.


[User] Please transcribe this text

[Assistant] Anemones and corals anchor themselves on the ledges.


[User] Please transcribe this text

[Assistant] The salt layer is more buoyant, so it pushes its way to the surface.


[User] Please transcribe this text

[Assistant] Forming dipheres or vertical intrusions through the overlying sediment, like salt domes and pillars.


[User] Please transcribe this text

[Assistant] Some of the salt dissolves and flows into the dipheres to form a lake of dense anoxic hypersaline water called a brine pool.


[User] Please transcribe this text

[Assistant] And it's the presence of dissolved methane in the brine that means these surreal pools often coincide with cold-seep activity, allowing for chemosynthetic life to thrive.


[User] Please transcribe this text

[Assistant] What makes brine pools unique among cold-sleep environments is the zonation of the life found here. Due to the toxic nature of the brine itself,


[User] Please transcribe this text

[Assistant] They can be considered islands of abundance on the sea floor, isolated from one another in patches dotted along the continental margins.


[User] Please transcribe this text

[Assistant] But they are also transitory, existing only briefly, with the seepage of any one sight not lasting forever.


[User] Please transcribe this text

[Assistant] This explains the origins of carbonate reefs towering rock chimneys.


[User] Please transcribe this text

[Assistant] This self-destructive process may give rise to a pattern of ecological succession at certain cold seats, beginning with the arrival of bacteria that aggregate into mats.


[User] Please transcribe this text

[Assistant] Once seepage is blocked, the muscle beds are starved.


[User] Please transcribe this text

[Assistant] But tubeworm meadows live on a little while longer, due to their ability to burrow down and tap into the sulphide flux directly.


[User] Please transcribe this text

[Assistant] As the die-off of tube worms clears the way for colonization by stony corals.


[User] Please transcribe this text

[Assistant] The corals, along with other sessile animals, make use of these outcrops as vital attachment points amidst the soft muds of the abyssal plain.


[User] Please transcribe this text

[Assistant] The deep sea coral gardens shown here are formed around structures that may well have once been sites of chemosynthetic activity in the form of cold seeps centuries prior.


[User] Please transcribe this text

[Assistant] In conclusion, cold seeps are an unusual collection of deep sea habitats that show off the ability of life to make the most of an energy source in the most challenging of environments.


[User] Please transcribe this text

[Assistant] We've taken a look at the two main examples of chemosynthetic oases, hydrothermal vents and cold seeps.


[User] Please transcribe this text

[Assistant] During the first stage, vibrant assemblages of mobile scavengers gather out of the depths and strip the bones of all flesh in a matter of months.


[User] Please transcribe this text

[Assistant] The enrichment opportunist stage follows, during which invertebrates colonise the bones and make the most of any remaining organic material that enriches the surrounding sediments.


[User] Please transcribe this text

[Assistant] And can support bacterial mats of chemosynthetic microbes that carpet the whale bones.


[User] Please transcribe this text

[Assistant] The result is a temporary localized chemosynthetic environment.


[User] Please transcribe this text

[Assistant] Able to support a community of animals surviving not on flesh, but on the energy released by the microbes.


[User] Please transcribe this text

[Assistant] We find grazers like amphipods, and suspension feeders like tube worms, blooming out of the surrounding sediment.


[User] Please transcribe this text

[Assistant] Animals here may represent ancestral species, belonging to the lineages of specialized vent and seep inhabitants.


[User] Please transcribe this text

[Assistant] With around 1600 new whale carcasses settling on the seafloor each year, and with each one lasting several decades,


[User] Please transcribe this text

[Assistant] These mackerel, attached to an ROV and sent to the sea floor, were devoured in less than a day.


[User] Please transcribe this text

[Assistant] This jellyfish, consisting of soft, gelatinous flesh, was consumed entirely in a matter of hours.


[User] Please transcribe this text

[Assistant] And yet despite being covered with more than 50 eel pouts, considerably more flesh endured than what we would expect of a carcass this large.


[User] Please transcribe this text

[Assistant] The sandpaper-like skin is too tough for the jaws of many scavengers.


[User] Please transcribe this text

[Assistant] It's for this reason that whales are considered keystone species.


[User] Please transcribe this text

[Assistant] Providing vital and unique services to the ecosystem in both life and death.


[User] Please transcribe this text

[Assistant] Deep beneath the ocean surface, familiar but unexpected features can be found resting against the sea floor.


[User] Please transcribe this text

[Assistant] has become incredibly resourceful, able to make the most of even unexpected resources. So it comes as no surprise that the deep ocean hosts complex biological communities that are adapted to thrive on this sunken wood.


[User] Please transcribe this text

[Assistant] They're called woodfalls, and they're able to support these biological hotspots by providing both a concentrated source of nutrients.


[User] Please transcribe this text

[Assistant] And a solid surface that sessile animals can anchor to.


[User] Please transcribe this text

[Assistant] Belonging to the genus Xylophagia, and growing no longer than an inch, these bivalves are woodfall specialists.


[User] Please transcribe this text

[Assistant] This is because, in order to consume the solid fibrous wood, they have had to specialize, evolving a number of traits that not many species possess.


[User] Please transcribe this text

[Assistant] While a large muscular foot extends from the shell and is used for leverage, they behave like living chisels. The bivalves ingest the fragments they break off, but even now the wood is tricky to digest without help.


[User] Please transcribe this text

[Assistant] Squat lobsters of the species Munidopsis andamanica instead opt for the outer layers.


[User] Please transcribe this text

[Assistant] Rather than boring, the squat lobsters have developed spoon-like claws that tear away at the wood surface.


[User] Please transcribe this text

[Assistant] The bivalves and squat lobsters represent the astounding ability of life to make the most of any available resource. For these are deep sea animals adapted to thrive on land plants.


[User] Please transcribe this text

[Assistant] Where worms and beetles break down the debris and cycle the nutrients back into the ecosystem and enrich surrounding sediments.


[User] Please transcribe this text

[Assistant] In fact, both are dominated by crustaceans.


[User] Please transcribe this text

[Assistant] On land, woodlice burrow down into felled stumps and branches, while in the depth sits their cousins the squat lobsters that take advantage of this resource.


[User] Please transcribe this text

[Assistant] Another similarity is that woodlice, termites and other terrestrial detritivores


[User] Please transcribe this text

[Assistant] The aforementioned bacteria that are able to break down the wood do so anaerobically, forming sulphide as a byproduct.


[User] Please transcribe this text

[Assistant] This sulphide can then be used by chemosynthetic bacteria, making Woodfall's sites of partial chemosynthetic primary production


[User] Please transcribe this text

[Assistant] Bathymodiolus muscles are one example of an animal that rely not on the wood itself, but on the microbes, feeding on the nutrients they produce.


[User] Please transcribe this text

[Assistant] Ecological stepping stones that allow the muscles to disperse between vents and seeps, in a similar manner to whale falls.


[User] Please transcribe this text

[Assistant] Both environments may form corridors on the sea floor that allow chemosynthetic communities to spread to new chemically similar habitats. And they do so by producing thousands of larvae, released into the ocean


[User] Please transcribe this text

[Assistant] The rapid utilization and exploitation of wood by deep sea organisms means woodfalls are often short-lived.


[User] Please transcribe this text

[Assistant] Seen here is part of the whaling ship's tri-works, large iron pots that were used to boil down blubber.


[User] Please transcribe this text

[Assistant] And animals in the southern ocean have not adapted to use wood as a food source.


[User] Please transcribe this text

[Assistant] Endurance is still an oasis of life for deep sea creatures.


[User] Please transcribe this text

[Assistant] That use it simply as a solid surface to attach to.


[User] Please transcribe this text

[Assistant] The colonizers of endurance are predominantly filter feeders, making use of specialized appendages to pull organic particles out of the ocean.


[User] Please transcribe this text

[Assistant] Sea lilies, a type of echinoderm closely related to starfish, use hair-like structures to adopt this way of life, living alongside sea squirts, which instead trap food by cycling water in and out through tube-like siphons.


[User] Please transcribe this text

[Assistant] A brisingid sea star also decorated the helm, waving its arms in the water to catch debris.


[User] Please transcribe this text

[Assistant] The first time a crab has been observed in the Weddell Sea.


[User] Please transcribe this text

[Assistant] Similar communities to those observed at Endurance tend to dominate metal shipwrecks in other parts of the ocean, including many that endure from the Second World War.


[User] Please transcribe this text

[Assistant] Whale falls and wood falls are vital stepping stones that allow opportunistic deep sea creatures to disperse and colonize new regions and adapt to new conditions and ways of life.


[User] Please transcribe this text

[Assistant] Our stage today is still that central island in the Pacific Ocean, Big Island.


[User] Please transcribe this text

[Assistant] And the star of the show is Hawaii Volcanoes National Park.


[User] Please transcribe this text

[Assistant] Legend has it that Kilauea is the sacred home of the volcano goddess Pele. But don't expect the park to offer much adrenaline-pumping danger. What we'll most likely await you in daylight is a cloud of white smoke.


[User] Please transcribe this text

[Assistant] The attraction closest to the visitor center is the Sulphur Banks, just 600 meters away. There's lava on both sides of the path, dyed yellow from sulfuric acid gases. The closer you are to the Sulphur Banks, the stronger the smell of rotten eggs.


[User] Please transcribe this text

[Assistant] Sure, you're just seeing a bunch of smoke right now, but at sunset, for a split second, you'll see the reflection of the glow from the volcano's lava in the clouds, painting the heavens a fiery red. Enjoy. This is the best shot of the day.


[User] Please transcribe this text

[Assistant] MST is absolutely amazing. I think my mom would love this.


[User] Please transcribe this text

[Assistant] She always tells me that when I come to England, I have to buy her some tea.


[User] Please transcribe this text

[Assistant] Loose leaf tea. You see, I'm not really a tea drinker, but my mom would absolutely love this place. She could probably spend four hours just looking at tea. We got breakfast tea, London edition. I need to ask because I'm lost.


[User] Please transcribe this text

[Assistant] But I also heard something about like a pyramid shaped tea bag.


[User] Please transcribe this text

[Assistant] Are there certain types of tea that are more popular with young versus old people?


[User] Please transcribe this text

[Assistant] I'm gonna base my choice on both the flavor and the packaging.


[User] Please transcribe this text

[Assistant] Hello, I'm Wendy Wolf. I'm Peppa Pig.


[User] Please transcribe this text

[Assistant] Illustrated by Brian Dumb. Focus question. Where does Sydney swing?


[User] Please transcribe this text

[Assistant] Sydney swings above the grass.


[User] Please transcribe this text

[Assistant] You're terrible with numbers. You can't even remember your own telephone number.


[User] Please transcribe this text

[Assistant] So as I know, you have no experience of scuba diving before, but have used, uhm, snorkel before? No. No. Okay. But, uhm, can you use straw? Like for drinking? Yes, I can use the straw.


[User] Please transcribe this text

[Assistant] So uhm, just, we are not having a race in the water. So yeaah, you know, enjoying the time in the water. So yeaah. Oh good. So any more questions?


[User] Please transcribe this text

[Assistant] Uh, because dinosaurs ate potatoes?


[User] Please transcribe this text

[Assistant] Furthermore, there are also a series of fun activities that tourists can try out for themselves. Such as body painting, dart and spear throwing.


[User] Please transcribe this text

[Assistant] How deep did it go? What landforms if any could be found there?


[User] Please transcribe this text

[Assistant] Whether there was anything more than a featureless stretch of mud, they did not know.


[User] Please transcribe this text

[Assistant] But when early explorers cast their weighted lines over the sterns of boats to measure the depths


[User] Please transcribe this text

[Assistant] They uncovered clues to a far more complex landscape.


[User] Please transcribe this text

[Assistant] Yawning chasms eclipsed by the dark of the abyss And underwater mountains


[User] Please transcribe this text

[Assistant] Bringing nutrients and creatures from the marine expanse together in one place.


[User] Please transcribe this text

[Assistant] Breaking the flat monotony of the abyssal plains, the underwater mountains emerge from the mud.


[User] Please transcribe this text

[Assistant] More than 450 volcanoes line this path with a Pacific Plate.


[User] Please transcribe this text

[Assistant] Collides with or pulls away from neighboring plates. Many of the seamounts that line the ring of fire


[User] Please transcribe this text

[Assistant] Encompassing 444 kilometres, or 276 miles of California's coastline,


[User] Please transcribe this text

[Assistant] And over 15,500 square kilometres, or 6,000 square miles of open ocean.


[User] Please transcribe this text

[Assistant] While the scale of these underwater monuments is impressive in its own right.


[User] Please transcribe this text

[Assistant] The abundance, variety and complexity of life at Seamounts is breathtaking.


[User] Please transcribe this text

[Assistant] Many deep sea animals are sessile, meaning they attach themselves permanently to rocks to live out their lives.


[User] Please transcribe this text

[Assistant] Seamounts provide the sanctuary they need to survive.


[User] Please transcribe this text

[Assistant] Creatures that are sparse and scattered out on the abyssal plain.


[User] Please transcribe this text

[Assistant] Corals and sponges are dependent upon ocean currents to bring this food to them.


[User] Please transcribe this text

[Assistant] The currents produce a localized upwelling of water around the mounts.


[User] Please transcribe this text

[Assistant] Planktonic prey in marine snow are lifted from the cavernous deep towards the sunlit surface.


[User] Please transcribe this text

[Assistant] Nutrients that are essential for the growth of phytoplankton in the sunlight zone.


[User] Please transcribe this text

[Assistant] Such a veritable feast as this creates an explosion of activity.


[User] Please transcribe this text

[Assistant] Larger animals, from whales and sharks to swarming seabirds, gather at the seamounts to feed, migrating for miles to convene here.


[User] Please transcribe this text

[Assistant] Animals not normally seen together can be found living side by side.


[User] Please transcribe this text

[Assistant] And the first undersea island to be called a seamount.


[User] Please transcribe this text

[Assistant] And 13 kilometres, or 8 miles wide, it is among the largest ever discovered.


[User] Please transcribe this text

[Assistant] Where one of the most important deep sea discoveries was made.


[User] Please transcribe this text

[Assistant] It was believed that corals could only exist in high abundance, in warm water, and required the light of the sun to survive.


[User] Please transcribe this text

[Assistant] This is one of the oldest coral forests, with some individuals rising more than three metres high and having lived for over a hundred years. Unlike tropical reefs,


[User] Please transcribe this text

[Assistant] They can thrive in waters as cold as minus one degrees celsius, and as deep as 3,050 meters, or 10,000 feet below sea level. Instead of obtaining energy from sunlight, they have become scavengers and predators, catching dead organic material or ensnaring plankton.


[User] Please transcribe this text

[Assistant] Coral communities are not the only gardens found at the depths of Davidson Seamount.


[User] Please transcribe this text

[Assistant] Aggregations of thousands of mother octopuses are found nursing their eggs.


[User] Please transcribe this text

[Assistant] Tucked into rocks near shimmering hydrothermal fluid seeps.


[User] Please transcribe this text

[Assistant] They make use of the heated water to incubate their long white eggs.


[User] Please transcribe this text

[Assistant] While protecting them with their eight arms facing outwards.


[User] Please transcribe this text

[Assistant] This sprawling community was discovered as recently as 2018 by the EEV Nautilus team.


[User] Please transcribe this text

[Assistant] Plumes of magma rise through the crust at the centre of plates.


[User] Please transcribe this text

[Assistant] And erupt through the sea floor to create chains of seamounts, such as the Hawaiian Islands.


[User] Please transcribe this text

[Assistant] The hotspot itself is fixed, while the plate is moving. And as it drifts, successive mountains are formed one by one.


[User] Please transcribe this text

[Assistant] Creating the string of islands that make up Hawaii's island chain.


[User] Please transcribe this text

[Assistant] These isolated islands are home to familiar creatures that have transformed themselves in bizarre ways, letting evolution run wild.


[User] Please transcribe this text

[Assistant] Demonstrating the effects of isolation on communities of life that find themselves secluded from the mainland.


[User] Please transcribe this text

[Assistant] Join me in the next video as we explore the life of remote islands, and the fascinating ecosystems that form


[User] Please transcribe this text

[Assistant] Wet Wally Written by Nigel Pepperhouse Illustrated by Hugh Jamieson Focus Question How would you describe Wally's day? Why?


[User] Please transcribe this text

[Assistant] Wally got his pants wet.


[User] Please transcribe this text

[Assistant] Wally got his work wet.


[User] Please transcribe this text

[Assistant] Wally got his lunch wet.


[User] Please transcribe this text

[Assistant] Wally got his shoes wet.


[User] Please transcribe this text

[Assistant] Connections. Writing and art. What else could Wally get wet?


[User] Please transcribe this text

[Assistant] Draw a picture and write this sentence. Wally got his wet. Math.


[User] Please transcribe this text

[Assistant] Sort the wet things in this story into groups. Share your ideas with a partner.


[User] Please transcribe this text

[Assistant] Okay, let's talk about something super, super cool. And that is hash tables and separate chaining. Alright, let's dive right in. What is separate chaining?


[User] Please transcribe this text

[Assistant] So separate chaining is just one of many, many hash collision resolution techniques.


[User] Please transcribe this text

[Assistant] And how it works is when there's a hash collision.


[User] Please transcribe this text

[Assistant] Meaning two keys hash the same value we need to


[User] Please transcribe this text

[Assistant] Have some sort of way of handling that within our hash table. So that's still functional. Well, what separate chaining does is it maintains an auxiliary data structure to


[User] Please transcribe this text

[Assistant] Essentially hold all the collisions and so we can go back and look up


[User] Please transcribe this text

[Assistant] Inside that bucket or that data structure of values for the item we're looking for.


[User] Please transcribe this text

[Assistant] And usually we use the linked list for this, but it's not limited to only linked lists. We can use arrays, binary trees, self balancing trees, or even a hybrid approach.


[User] Please transcribe this text

[Assistant] Okay, so suppose we have the following hash table, which is just a fancy name for an array of key value pairs of age and names.


[User] Please transcribe this text

[Assistant] And we associate an arbitrary hash value that has been computed with some hash function. So those are hash values, they don't really matter for now. We're just going to see how we can use separate chaining to handle the collisions.


[User] Please transcribe this text

[Assistant] Okay, so on the left is our hash table, so our array.


[User] Please transcribe this text

[Assistant] And I'm going to be inserting all these key value pairs into this hash table via separate chaining and you'll see how easy it is. Okay, so our first person is will his age is 21. And he


[User] Please transcribe this text

[Assistant] hashed to three. So we're going to put him in that slot three.


[User] Please transcribe this text

[Assistant] Leah age 18 hash to four, since she hashed to four, we're going to put her at index four. So the hash is a way to index into the array.


[User] Please transcribe this text

[Assistant] And Ray age 25 hash one. Okay, we're starting to get a little bit full.


[User] Please transcribe this text

[Assistant] And our hash table here, so we might get some collisions pretty soon. Okay, Lara age


[User] Please transcribe this text

[Assistant] That's 34 hash to 4, but we say, oh shoot, Leah is already there.


[User] Please transcribe this text

[Assistant] What do we do? Well, in separate chaining, we just chain along. So essentially each


[User] Please transcribe this text

[Assistant] Each position in the array is actually a linked list data structure.


[User] Please transcribe this text

[Assistant] So we're going to scan through the linked list and see if Lara exists. And if Lara does not exist, then we're going to add Lara at the very end of the chain. Okay. So Ryan also hashed to one


[User] Please transcribe this text

[Assistant] And oh, Lara already existed in our hash table.


[User] Please transcribe this text

[Assistant] So we're good. And she still has the same age, so we don't need to update it.


[User] Please transcribe this text

[Assistant] So fin age 21 hash to three. So is your hash collision with will who had also hash to three. So what we're going to do is we're going to append fin to the end of the length list chain.


[User] Please transcribe this text

[Assistant] So note that even though that will and Finn both hashed to same value that is index three, and they have the same age, we tell them apart because we store both the key and the value.


[User] Please transcribe this text

[Assistant] As an entry in our linked list block. So that's how we're able to tell them apart.


[User] Please transcribe this text

[Assistant] Okay, now I want to insert Mark, whose age is 10, and who has to four. So


[User] Please transcribe this text

[Assistant] Scan through the linked list at index four for mark, and it's not found. So we have to append mark at the very end.


[User] Please transcribe this text

[Assistant] Alright, now let's have a look at how we can do lookups in this structure. So it's basically the same thing.


[User] Please transcribe this text

[Assistant] So what we're going to do is given a name, we want to find what the person's age is. So suppose we have Ryan Ryan, when we hash him, we get one. So we suspect that Ryan should be in bucket one.


[User] Please transcribe this text

[Assistant] When I say a bucket, I just mean whatever data structure we're using.


[User] Please transcribe this text

[Assistant] At index one, in our case a link list. So I have to scan this link list for Ryan. So start right now. So here we're comparing the key. So we're comparing the key Ryan to the key array.


[User] Please transcribe this text

[Assistant] And there's not a match. So keep going. Compare Ryan to Ryan. There's a match. Okay, we found Ryan and then inside that entry, say, Oh, his age is 56. So return 56.


[User] Please transcribe this text

[Assistant] Okay, let's do another one. Find the age of Mark. Hash Mark. And...


[User] Please transcribe this text

[Assistant] Since our hash functions are deterministic, we know that if there's a mark,


[User] Please transcribe this text

[Assistant] Then it's going to be found in position four. Okay, so we look in the bucket four


[User] Please transcribe this text

[Assistant] Scan through Oh, last one is a mark. So we return age 10.


[User] Please transcribe this text

[Assistant] So it might happen that the value or the key looking for doesn't exist. And so it doesn't exist. You return no.


[User] Please transcribe this text

[Assistant] Okay, so here's a good question. How do we maintain a constant time insertion and lookup time complexity?


[User] Please transcribe this text

[Assistant] If the hash table gets really full and I have some long, lengthless chains.


[User] Please transcribe this text

[Assistant] Good question. And the answer is that once there's a lot of elements within your hash table,


[User] Please transcribe this text

[Assistant] A table. Because tables are fixed size.


[User] Please transcribe this text

[Assistant] Okay, and another good question. How do I remove key value pairs from my hash table with separate chaining? Well, the answer is basically the same procedure. You hash your key


[User] Please transcribe this text

[Assistant] And instead of doing a lookup, well, you would remove a particular entry in the linked list. That's it.


[User] Please transcribe this text

[Assistant] Another question, how do I use, can I use another data structure to model the bucket behavior of separate chain? And yes, of course.


[User] Please transcribe this text

[Assistant] And common data structures that are used inside the linked lists include arrays, binary trees, self-balancing trees. Java uses a hybrid approach in their hash map


[User] Please transcribe this text

[Assistant] So once they get to a certain chain length, they switch to a binary tree or maybe a self balanced binary tree. I'm not too sure.


[User] Please transcribe this text

[Assistant] However, these alternative methods are a bit more memory intensive and complex to implement, which is why they may be less popular, but they might be a lot faster to have an actual implement them myself. So have a look at those.


[User] Please transcribe this text

[Assistant] Okay, so that's it for this video. Next video we're going to be going over hash tables with open addressing which I'm really excited about.


[User] Please transcribe this text

[Assistant] So guys, if you want an implementation of a hash table with separate chaining


[User] Please transcribe this text

[Assistant] There's going to be one at github.com slash willing to use that slash data dash structures. And I will also be going over some source code in the next video. So stay tuned for that. Thanks so much for watching. Catch you later.


[User] Please transcribe this text

[Assistant] I'm doing pretty well, and I think we've got a good lesson today, a really helpful lesson.


[User] Please transcribe this text

[Assistant] A financial advisor is a person who gives suggestions or recommendations about investing money. Someone who wants you to put money in the stock market.


[User] Please transcribe this text

[Assistant] Well, I guess Ms. McNeely does not want to speak to any financial advisors.


[User] Please transcribe this text

[Assistant] So four words today. The first one is available. Available. Available. Available. Meaning? That you are not busy. That you're free. You're free.


[User] Please transcribe this text

[Assistant] Exactly. Let's move to our next word. Double check. Double check. Double check.


[User] Please transcribe this text

[Assistant] I think we've got some examples of this phrase.


[User] Please transcribe this text

[Assistant] Yeah, we've got a lunch scheduled this afternoon, don't we?


[User] Please transcribe this text

[Assistant] Solid basically is? You have no free time, no available time.


[User] Please transcribe this text

[Assistant] There's some great examples in this dialogue of phrases you can use when you need to schedule an appointment. And we're going to look at those today. In the dialogue, we heard Julianne ask about making an appointment and she said this.


[User] Please transcribe this text

[Assistant] Yep, and we have some more examples of this phrase.


[User] Please transcribe this text

[Assistant] Yes, and like we said earlier, it's language you can use when you need to talk about work. With your boss, maybe?


[User] Please transcribe this text

[Assistant] Yep, you can use this in all those situations.


[User] Please transcribe this text

[Assistant] Just let me try to stand up. Oh, wait a second. You seem really familiar. I think I know you from somewhere.


[User] Please transcribe this text

[Assistant] Ouch. My ankle. I think it's broken. You can't just leave me like this. Are you calling an ambulance?


[User] Please transcribe this text

[Assistant] Uh, everything except pirate's treasure.


[User] Please transcribe this text

[Assistant] Oh, another glass vase.


[User] Please transcribe this text

[Assistant] Okay, on today's language takeaway we have five words for you today. Five really important and useful words that we found in our dialogue. So let's take a look at the first one. Step on it.


[User] Please transcribe this text

[Assistant] So what does it mean when I tell you to step on it? Drive faster. Drive faster, right? Step on it.


[User] Please transcribe this text

[Assistant] Yes. Speed up. That's exactly it. Our second word, speed up.


[User] Please transcribe this text

[Assistant] Okay, great example. So, Erika, why don't you tell me, what does it mean when you have a fit?


[User] Please transcribe this text

[Assistant] Ears. Okay, that's having a fit. Exactly. Excellent. Okay, let's take a look at our next word now.


[User] Please transcribe this text

[Assistant] Cut through. Cut through. Cut through. Cut through. When you cut through something, it means you just go through. Go through.


[User] Please transcribe this text

[Assistant] Quickly, so I can say, let's cut through the park.


[User] Please transcribe this text

[Assistant] And this takes us to our last word for today, shortcut. Shortcut. Shortcut. Shortcut.


[User] Please transcribe this text

[Assistant] Okay, so going back just a little bit to cut through. If I cut through the park, that's basically a shortcut.


[User] Please transcribe this text

[Assistant] Now it's time to listen to our dialogue again, but this time it's gonna be slower, so then we can understand all these words that we just talked about.


[User] Please transcribe this text

[Assistant] Okay, so today I'm putting it together. We have three phrases for you.


[User] Please transcribe this text

[Assistant] Okay, so all of these phrases we heard in the dialogue, why don't we start with the first one? Make a. Make a.


[User] Please transcribe this text

[Assistant] So, in the dialogue they say, make a left here.


[User] Please transcribe this text

[Assistant] That would be the equivalent of saying turn left. Or turn right. Turn right. And there's one more. Make a U-turn.


[User] Please transcribe this text

[Assistant] If you're ever in a taxi and you're telling the taxi driver where to go, this is the perfect way. Make a left here, make a right there.


[User] Please transcribe this text

[Assistant] If somebody has a bad idea that you don't agree with, you would say, are you crazy or are you nuts?


[User] Please transcribe this text

[Assistant] So let's listen to some examples of, are you nuts?


[User] Please transcribe this text

[Assistant] Again, so if you're in a taxi, this is a great way to suggest a route.


[User] Please transcribe this text

[Assistant] Right, or, let's take the highway.


[User] Please transcribe this text

[Assistant] Okay, so now let's take a listen to this dialogue a third time at its normal speed, and now you can understand everything that's in this dialogue.


[User] Please transcribe this text

[Assistant] I, well, my car I got when I was like maybe 19.


[User] Please transcribe this text

[Assistant] Alright, so now you have all the tools necessary to give directions the next time you're in a car or in a taxi.


[User] Please transcribe this text

[Assistant] Welcome everybody to the lovely house and gardens of Rosewood, once the home of the famous writer Sebastian George.


[User] Please transcribe this text

[Assistant] He bought the house in 1902, although he had first seen it two years earlier. At that time, the owners let it out to a tenant because George was too slow making up his mind to buy it.


[User] Please transcribe this text

[Assistant] When it came back on the market, there was no hesitation, and he bought it immediately. For £9,300.


[User] Please transcribe this text

[Assistant] Even though the house had no bathroom, no running water upstairs, and no electricity.


[User] Please transcribe this text

[Assistant] His professional success was enormous, but his personal life wasn't as successful. He was no longer on speaking terms with his brother and had been devastated by the death at the age of seven of his elder daughter Josephine.


[User] Please transcribe this text

[Assistant] Moving to Rosewood allowed the family to start a new life.


[User] Please transcribe this text

[Assistant] The house and its grounds became the family haven and their escape to privacy and quiet.


[User] Please transcribe this text

[Assistant] The walls and the mullioned windows were built of the local sandstone. The tiles on the roofs and the bricks of the chimney stack were baked from local clay. And the wooden structures inside came from oak trees which grow around here.


[User] Please transcribe this text

[Assistant] Please look at the map I've given you of the house and gardens. We're here at the information centre.


[User] Please transcribe this text

[Assistant] Follow the path marked with the arrow and the first area you come to is the orchard on your left.


[User] Please transcribe this text

[Assistant] As you go further down the path, there's the kitchen garden on the right. And as you go round the first sharp corner, you will find to your left an area where different types of pear tree have been planted, as well as some lovely flowers. And this is known as Pear Alley, designed by George himself.


[User] Please transcribe this text

[Assistant] Follow the path round the second corner and on your right you will see the entrance to the Mulberry Garden with its 500 year old tree.


[User] Please transcribe this text

[Assistant] If you would like to purchase any of George's books or other souvenirs, then leave the house by the side entrance, where you will find our shop, which is situated between the house and the garage, which contains the magnificent old Rolls Royce car, which used to belong to George.


[User] Please transcribe this text

[Assistant] Most visitors are. So why don't you visit the tea room on the far side of the garage?


[User] Please transcribe this text

[Assistant] If you have time, there is a lovely walk down towards the River Dudwell. For me, this is the best part of the estate.


[User] Please transcribe this text

[Assistant] This isn't on the map, but it is all clearly signposted. You cross the field, which spreads along the banks of the river. In spring, this area is well worth a visit.


[User] Please transcribe this text

[Assistant] Spend a minute or two watching the water pass by underneath as you cross the footbridge and then continue along the river walk through the woodland.


[User] Please transcribe this text

[Assistant] On a hot summer's day the trees along this path provide welcome shade. Eventually you come to the water mill, which used to provide the electricity for the house.


[User] Please transcribe this text

[Assistant] Today I want to talk about the Fenwick tree, also sometimes called the binary index tree and you'll see why very soon.


[User] Please transcribe this text

[Assistant] This is one of my personal favorites because it's such a powerful data structure and it boasts efficiency and it's really, really simple to code. So let's dive right in.


[User] Please transcribe this text

[Assistant] So things we're covering the Fenwick tree video series and just some standard stuff. So go over some motivation why this data structure exists, analyze its time complexity, and then go into some implementation details. So in this video, we'll get to the range query


[User] Please transcribe this text

[Assistant] And later videos, how to do point updates and how to construct a tree in linear time. You can also do things like range updates, but I'm not going to be covering that in this series. At least not yet.


[User] Please transcribe this text

[Assistant] Okay, so what is the motivation behind the Fenwick tree?


[User] Please transcribe this text

[Assistant] So suppose we have an array of integer values and we want to query a range and find the sum of that range. Well, one thing we can do would be to


[User] Please transcribe this text

[Assistant] Start at the position and scan up to where we want to stop and then sum all the individual values between that range.


[User] Please transcribe this text

[Assistant] That's fine. We can do this. However, it'll soon get pretty slow because we're doing linear queries, which is really bad. However,


[User] Please transcribe this text

[Assistant] If we do something like compute all the prefix sums for the array a, then we can do


[User] Please transcribe this text

[Assistant] queries in constant time, which is really, really good.


[User] Please transcribe this text

[Assistant] So if we set the array P index zero to be zero, and then we go in our array A and add that element to the current prefix sum.


[User] Please transcribe this text

[Assistant] We get five and then five plus or minus three.


[User] Please transcribe this text

[Assistant] And so on. So this is an elementary form of dynamic programming right here, calculating all the prefix sums. And then if we want to find the sum


[User] Please transcribe this text

[Assistant] From say two to seven non inclusive, then we can get the difference between those two indices in the P array.


[User] Please transcribe this text

[Assistant] And that's a constant time thing to compute the sum of the values between two and seven on inclusive. So that's really great. However, there's a slight flaw in this, which is what happens when we want to update a value in our original array, a say, we want to update in text for


[User] Please transcribe this text

[Assistant] To be three well now we have to recompute all the prefix sums.


[User] Please transcribe this text

[Assistant] So this is really bad because can recalculate all those prefix sums and take up to linear time.


[User] Please transcribe this text

[Assistant] This is why the Fenwick tree was essentially created. So what is the Fenwick tree? The Fenwick tree


[User] Please transcribe this text

[Assistant] Is a data structure that supports range queries on arrays and also point updates.


[User] Please transcribe this text

[Assistant] Also range queries, but we won't be covering that in this video.


[User] Please transcribe this text

[Assistant] So it's construction is linear time, point updates are logarithmic.


[User] Please transcribe this text

[Assistant] Range some queries also logarithmic range updates logarithmic but you can't say add elements to the array can't make the array bigger or entirely remove elements


[User] Please transcribe this text

[Assistant] First thing you need to know is that unlike a regular array, a Fenwick tree


[User] Please transcribe this text

[Assistant] Each cell is not responsible for itself, but rather for a range of other cells as well.


[User] Please transcribe this text

[Assistant] We're going to say that a cell is responsible for other cells, depending on what the value of its least significant bit is and its binary representation. So on the left,


[User] Please transcribe this text

[Assistant] I have a one based array. Fenwick trees are one base. That's very important. And I've, on the side of that, I also put the binary representation of each of the numbers so you can clearly see what they look like in binary.


[User] Please transcribe this text

[Assistant] So if we have say the index 12, it's binary representation is 1100. So the least significant bit is that leftmost bit.


[User] Please transcribe this text

[Assistant] For, we're going to say two to the power of the position minus one, so four cells below itself.


[User] Please transcribe this text

[Assistant] Similarly, 10 has a binary representation of 1010.


[User] Please transcribe this text

[Assistant] And the least significant bit is at position two. So it's responsible for two cells below itself. And 11,


[User] Please transcribe this text

[Assistant] Uh, it has the least significant bear position one, so it's the only responsible for one's self. Itself. So.


[User] Please transcribe this text

[Assistant] For all the odd numbers, which are just responsible for themselves. So that's what the blue bar indicates. The blue bars don't represent value, they represent a range of responsibility. And that's really important for you to keep in mind. So now,


[User] Please transcribe this text

[Assistant] All the cells which have a range responsibility of two.


[User] Please transcribe this text

[Assistant] Notice that all these ranges of responsibilities are powers of two.


[User] Please transcribe this text

[Assistant] Is responsible for eight cells.


[User] Please transcribe this text

[Assistant] So now how do we do a range query on this now that we're not really working in this standard array but rather this weird type of range of responsibilities?


[User] Please transcribe this text

[Assistant] And the answer is we're going to calculate the prefix sum up to a certain index. And that's what's eventually going to allow us to do arrange queries.


[User] Please transcribe this text

[Assistant] So let's figure out how to do prefix sums, just like we did for a regular array, but on this finite tree.


[User] Please transcribe this text

[Assistant] So the idea is we're going to start at some index and cascade downwards until we reach zero, you'll soon see what I mean. So for example, let's find the prefix sum up to index seven.


[User] Please transcribe this text

[Assistant] So we're calculating the prefix sum from index one one to seven inclusive. Usually everything in a finite tree is inclusive.


[User] Please transcribe this text

[Assistant] So we can get the value in the array at position seven, and then we want to cascade downwards. So the next guy below us is six, and then four.


[User] Please transcribe this text

[Assistant] Notice that we're like hopping down. So we start seven and then we move down to six. And then from six we go down.


[User] Please transcribe this text

[Assistant] So we're at two levels because six has a range is responsible to and then we're at four and four is a range responsibility of force that brings us all the way down to zero and we're always going to be able to go from where we are all the way down to zero. So the prefix sum for


[User] Please transcribe this text

[Assistant] Seven is the array index seven plus the array index six plus the array index four.


[User] Please transcribe this text

[Assistant] Alright, now to find the prefix sum for index 11. So we always start at where we are. So that's 11.


[User] Please transcribe this text

[Assistant] And then we're going to cascade down. So the cell directly below us is 10.


[User] Please transcribe this text

[Assistant] And then 10 is a range is responsible to so we're going to go down to. So that's eight, and then eight brings us all the way down directly to zero. Okay,


[User] Please transcribe this text

[Assistant] So for we start for for as a range of responsibility of exactly four sets already, we're back down to zero so we can stop. Okay,


[User] Please transcribe this text

[Assistant] Let's pull this all together and try to do an interval sum between i and j. So let's calculate the interval sum between


[User] Please transcribe this text

[Assistant] So the idea is we're going to calculate the prefix sum of 15 and 11.


[User] Please transcribe this text

[Assistant] So we're going to calculate prefix sum of 15. And then we're going to calculate the prefix sum up to 11. But notice that we're not going to calculate up to 11.


[User] Please transcribe this text

[Assistant] Inclusive, but exclusive because we want the value at 11.


[User] Please transcribe this text

[Assistant] Then we cascade down until we hit zero. So 15 has a range of responsibility of one so subtract one from 15, then we get to 14. And 14 has a range of responsibility of two, because the least significant bit on 14 is two. Okay, now we


[User] Please transcribe this text

[Assistant] Go to 12 and then keep cascading down. So the prefix sum for 15


[User] Please transcribe this text

[Assistant] It's 50 array at index 15 plus here at 14 plus 12 plus eight. All right. Now the prefix sum for up to 11 non inclusive, so we're going to start 10. Now we want cascade down until we hit zero.


[User] Please transcribe this text

[Assistant] So 10 has a range of response with two subtract two from 10. We get to eight.


[User] Please transcribe this text

[Assistant] Now from eight has a range of responsibility of eight. So casket down.


[User] Please transcribe this text

[Assistant] The range sum is the sum of all the indices of 15 minus those of 10. Then that's how we would calculate the range sum.


[User] Please transcribe this text

[Assistant] So notice that in the worst case, we're


[User] Please transcribe this text

[Assistant] Um, has a one bit set and all zeros, but when you subtract one, then you get a whole bunch of ones. So if you look at like 15.


[User] Please transcribe this text

[Assistant] Almost all of its bits are 1s, and those are the worst cases.


[User] Please transcribe this text

[Assistant] In the worst case, we might be asked to query say, 15 and seven, both of which have a lot of ones in them. So we're doing about two log base two event operations.


[User] Please transcribe this text

[Assistant] But in the average case, this is actually pretty good. And we're going to implement this in such a way that it's just going to be bit manipulation. So this is like super fast.


[User] Please transcribe this text

[Assistant] So the range query algorithm is pretty much this. You see it's like literally no code.