Search for notes by fellow students, in your own course and all over the country.
Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.
Document Preview
Extracts from the notes are below, to see the PDF you'll receive please use the links above
Time Complexity and Big O Notation (with notes)
CodeWithHarry
So the input size didn't increase and the runtime of the algorithms didn't
increase either
...
When we ask
questions like as the input will increase, Then the runtime will change as per
what? And after that Now you will go to aunty's house You will be treated
...
I want to tell you guys one story
...
I was so bored that I needed some entertainment
...
So he has a collection of games
...
And you can get every type of game from him
...
He also uses jio and we get just 1 Gb for one day
...
So for me , what is the
fastest way to take the game from this friend
...
This means that as the input size is increasing like
that The time required to send the file , That is also increasing
...
You will go on that bike
...
As the input size of
algo2 increased like that what happened ? For that , there was no change in the
runtime
...
So we say as the size of the input keeps on
increasing , Similarly, what is the effect of the algorithm on runtime
...
is the algorithm that runs in constant time
...
The sentence is: Run time of it, there are some
things that we will recite
...
Now, come here and listen to another
story
...
If the game is
of N kb then how much time will you need? The sentence is: Run time of it, there
are some things that we will recite
...
There are also
algorithms that are not linear in time
...
we talked about order
...
We have primarily 3 types of asymptic notation big O, big
Theta (Θ ) and big Omega (Ω) big O is represented by capital (O), which is in
our English
...
Mathematically, mathematically this function can be
anything
...
G ( n) is
your function which will come inside the big O
...
If you guys
can find any such constant ( C ) and ( n ) -node , then f ( n) is O ( g ( n)"
This is the mathematical definition of big O
...
This question is its own truth , it has validity , it will
remain valid
...
THe author states that the complexity of
an algorithm is automatically O(n^5
...
& G ( n ) is
intersecting with f ( n )
...
What we have done is WE have taken a big
function and we have made it so that it is always below the original function
and that's what [UNK] means THe definition of [UNK] for a function
...
THIRD NOTES
Best Case, Worst Case and Average Case Analysis of an Algorithm (With Notes)
CodeWithHarry
To define an algorithm, To define the events in the life of an algorithm , We
have , Best Case Worst Case and Expected Case
...
If you watch this video
till the end , Then you will find out what this 'Log ' really is
...
5
...
9 and 24 are the numbers in it; They 're in ascending order , You can see
for yourself
...
Now what I say is that I 'll give a number : 'A' And I 'd like
you to tell me If this number exists within the array , or not
...
So what will be your answer ? Yes
...
If A is
...
If the value is 9, What
will the answer be ? Your answer will Algo 1 is a simple person
...
It is comparing it with all the numbers
...
Because Algo
...
It will tell us in the first comparison itself
...
If Algo 1 is in luck, The time needed is ' k ' - T=k
...
Take a 10-element array, take a single element array or take
a 10,000 element array
...
Now, AlGo 1 's luck is bad
...
Average Case
complexity is equal to
...
The O ( Sum of all possible run times divided by the number of
possibility ) is O ( n ) The average case complexity is the sum
...
to
...
possible run
...
by the total
...
So for an array size of 5, We saw six cases
...
n+1 If 'n ' is the size of the array , Then there is 'n+1
'' number of possibilities
...
If the element
is here, How many comparisons will it have to make ? It will have to do
...
2
...
I 've taken ' k ' as common out of everything
...
And this I have added separately
...
K n ( K is an integer ) And now what will happen? The value of 'k ' will
become very large And so 2n will be going down
...
THe Average Case Complexity for a
given algorithm is the time it takes to run through all possible cases, divided
by the total number of possibilities
...
Birbal
...
An example of how he does this
...
IF
...
, Algo 2 will find the mid-point of the array and be okay
...
After that we will do some set of questions
...
due to the time complexity of
any algorithm when you have to find it so what is the first step that you do and
at the same time how to approach this problem
...
We believe that
these operations are all (k ) time consuming This for loop , that is , how much
time is being taken for this fragment It seems ( kn ) , okay So before this
( int i ) would have been written here, ( int k=0 ) would be written here
...
The first fragment turned out to be this one , with a little bit of
initialization
...
I will go for ( n = 100 ) to determine whether i will be going for n = 1000
...
There
will be some code on it which will take ( k1 ) Now I have become so smart, by
doing questions , and you will be done too That (k1) it is will going to be nondominant , if constant is being added then we will remove it
...
Then ( j=1)
will become Then ( 0,2) Then (i=0 , and j=0 ) will then run for Okay
...
When ( n)
is running out, watch carefully , watch very closely
...
value of i will be ( 1) , ( n ),
it will be n-1 because I am taking the index ( i=0 ) then (i=n-1) will be and
here is ( n- 1 )
I told you guys If it 's not clear to you why it will work ( n² ) times So I 'd
say let 's go look at it for 3 and 3 and print here (i , j ) and make a count
variable and count it , how many times it is running You write ( c ) program ,
write in Python, write in Java, write in Python and write in the Java
...
And if another
loop is given inside it , then it will run ( n³ ) times
...
And I have also given their programs to
you
...
So it 's
saying that Find the time complexity ( Func1 ) function in the program shown in
program1
...
Even if you come from another programming language
nothing is going to be change
...
The time is not depending on Array 's
length so i 'll accept it ( k1 ) and I can not accept ( F2 ) as ( k ) , i will
accept it as k2 * n
...