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.

My Basket

You have nothing in your shopping cart yet.

Title: DSA chapter 2 to chapter 4
Description: work in progress of chapter 5 and other

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 NotationSo 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
...

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
...
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
...

chapter - 4
Best Case, Worst Case and Average Case
Analysis of an Algorithm
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
...
AP is used in 'O ' a
lot
...
When there are questions on
'O' APs and GPs are used in the answers
to questions on O
...

The Average Case Time is not generally
asked for a unique algorithm
...
So
what is the Average Case
...
Algo 1 was making 'n ' comparisons
...
Algo 2 is a cunning person
...
It made one comparison For a size
of 10 array , As well as for an array of size
100
...

The midpoint between 1 and 100 will be
50
...
If there
are an even number of elements here,
there are 2-2-4,2-6 elements
...
So I can take
either of them as midpoint
...
You
can halve 8 once, and it will become 4
...
How many times can you
divide 16 ? You can divide 16 once, twice,
twice and four times
...
So I told you a very good
definition of 'Log '
...
This definition that I have told you in
this course , You would n't have got it very
easily
...
You must
appreciate the definition of Log
Title: DSA chapter 2 to chapter 4
Description: work in progress of chapter 5 and other