Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary DSA Easy Notes

Rating
-
Sold
-
Pages
11
Uploaded on
15-03-2023
Written in
2022/2023

Easy to Understand and simple For memorizing

Institution
Course

Content preview

Time Complexity & Big O notation
Time complexity is the time taken by an algorithm as a function of the length of of of input. This
is time complexity in these three lines. Time complexity means an algorithm. Just as you
increase its length of input then how does that algorithm perform ? How does that algorithms
behave ? How do you use their constraints and tell which algorithm is to be used here ? Time
complexity has been invented and it basically tells us that which is the better algorithm among
the two ? And there comes in use - The Big O Notation. This Big O notation works to quantify
the time complexity of an algorithm. It tells that the this algorithm will take this much time
according to this length of input. Big O notation takes in account the bigger power and nothing
other than that. For any n which one is greater, obviously n is greater. Even if the constant is
large we 'll assume it as O ( 1 ) Even if there is a very large no. with n^2 then we 'will still
consider it O (n^2 ) If you will make the graph of n will be something like this.
Big O notation is mostly used in computer science because we remain safe by finding through
Big O notations for multiple algorithms. We constrain in THETA notation. OMEGA
NOTATION tells that what will be the lower bound of the algorithm. THETA and OMEGA
notation are other notations that tell us what is the time complexity of algorithms. Using the tree
method, we 'll try to find with the. tree method so that you can easily find the time complexity of
recursive functions. First of all, you write the non-recursive part in this way- n c. after that the.
recursive part is T ( n/2 ) and the. recursion part. After adding them then you 'll have n c
operations performed. You have to see the no. of operations performed at each step. If you want
to tell which algorithm is better according to the constraint in the online judges. Then what is the
method. I have already told you about this in a previous video. But if you still want to know then
I 'll tell you. Try finding their time complexities and tell me what did you find. I'll put their
answers in my telegram channel.
You just need to check that 10^8 operations rule is being followed and you can easily find if time
constraint is given to me then what will be the algorithm. Similarly if its given between 15-18
then this type of complexity will be accepted. If its given 100 then you can go till ( n^4 ) If 400 is
given, the you can then go till n^3. If you found that its - n log n , then the algorithms based on
it , you should strike at that time. It means I cab either apply sorting- it might be solved after
sorting or such an operation that can be don in - log n I can perform that operation n times , you
can
SO if it's given between 15-18,, then this type of complexity will be accepted. IF. It's given 100,
then you can go till (N^4). IF 400 is given, the you can go till (N^3), simple you can try it by
yourself, right!.

, Bit Manipulation Algorithms Part 1
DSA One course will study Bit manipulation, Bit magic and Bitwise operators. Bits are actually
very important from Competitive programming point of view. If your submission differs by just
few microseconds, then it affects your rank as well If you would be using BITWISE concepts ,
then your submission will be very fast. We will learn such tips and tricks in bits. You can convert
any decimal number to binary using this method. Addition/subtraction works in the same way as
they work in decimal numbers. In binary numbers, digits are from 0-9 but they go from 0 to 1 in
binary numbers. You will get use to it when you will practice it more So this is how your binary
number works. The main question is how to find the negative inverse of any number in binary is
2 's compliment. Negative inverse of a number which we have to subtract and then we will add it
to the other number to get our answer. The last carry will keep on making all the extra set bits as
0 and this carry will be discarded.
In micro-processors, all the additions/subtractions are done using this way only There is no
operation as Subtraction. We find the 2 's compliment and then add it with the other number.
You just have to inverse all the bits and add 1. Right shift operator shifts the bits towards right.
We use tilt ( ~ ) symbol to present inverse operation. We have left shift operator. When you have
to perform left shift by 2 , then you will shift all the bits towards left by 2 and it will get
converted to this We can replace the empty bits by zeroes This number equals to 48. We can use
it whenever we need to divide a number by 2 multiple times. This is how we use to find whether
a number is ODD or even. We will see more power of XOR in its 3rd video. In next video, we
will see bit masking and see what we can do with the help of Bit masking. The power of the
XOR operator is a very simple concept by computationally it is bit faster.

Written for

Course

Document information

Uploaded on
March 15, 2023
Number of pages
11
Written in
2022/2023
Type
SUMMARY

Subjects

$9.19
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
rohitsankpal

Get to know the seller

Seller avatar
rohitsankpal Exam Questions
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions