字幕列表 影片播放 列印英文字幕 Hey everyone. In this video, I'm going to give you an introduction to Big O notation and time complexity. These concepts basically give you one way of describing how the time it takes to run your function grows as the size of the input grows. To see what I mean by that exactly, let's take a look at a few examples here. First of all, let's say you are given an array like this and let's say that this array could be of any lengths. It could be one hundred elements long, a thousand elements long or even one hundred thousand elements. And let's say you want to write a function that takes this array and returns the sum of all the numbers in this array. So, in your function you wanna add up all the numbers of this array and returns the sum. And that function might look like this function right here and I'm gonna use pseudocode here to write this function. So, first of all let's define our function that gonna be called find sum which is going to take given array as input and then inside this function first of all we gonna initialize a variable called total to 0 and then for each i in this given array or for each number total to 0
A2 初級 大O記號和時間複雜度介紹(數據結構與算法#7) (Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7)) 2 0 林宜悉 發佈於 2021 年 01 月 14 日 更多分享 分享 收藏 回報 影片單字