DSA Java Notes is a comprehensive study guide for mastering data structures and algorithms using Java programming language. These notes are designed to help learners of all levels, from beginners to experienced programmers, understand and implement various data structures and algorithms effectively...
L1: Introduction To JAVA (In English) | Java Basics Course | Lesson 1 | DSA In Java
This video is a part of the series data structures and algorithms in java by coding ninjas the ultimate
guide from scratch to hash that makes you unbeatable in dsa using java. In this video we will see why we
should learn java how java came into the picture and it 's history. We 'll go to core aspects like features
of java terminologies used in java and also see a brief comparison between java and c plus plus. We will
see which tools are actually required to run java program in your pc. i will solve few questions on code
studio with you and at the end of that i will explain line to line the meaning of each line in the java. Java
is a platform independent application programming language because it is used to build applications
which do not have constraints over of its operating systems. The language is robust that means it is
reliable it is developed to put much effort into checking errors as early as possible that is why java
compilers can detect those errors which are not easy to see by other programming languages. There is
three phases in java program first of all we write the java code in our compiler then the compilation of
code of java is done by jvac. After writing the code it is sent to java compiler that is java compiler. Java
has jvm that has inbuilt program known as a garbage collector garbage collectors can recall objects that
are not referenced.
java cartridge collector can not recover the memory of objects that has been referenced for in very long
time earlier so what happens the objects that are not referral not referred what we can do or even not
us what garbage collector does it recollect the memory from them. Java does not support multiple
inheritance through class it can be achieved by using interfaces in java. Java is platform independent
language whereas c plus is not a platform independent. You need to make sure that you have a jdk that
is java development kit in this section. After the course you will be better prepared to crack data
structures and algorithms. We will use research studio code with extension so that it will make your life
easier to compile and run diagram and also we need a curious programmer. Everything in java follows
object oriented programming and everything is object. libraries which will help in input and output
operations okay libraries [ Music ] as you can see with the help of the extension these libraries are
currently breakdown because i have never used them. After writing the code you need to save the
program by using controllers and then you will need to play the.
Code Studio's Code Studio shows how to use java's code studio's code. The code is a brief and good
sample code to give you more clarity. In this coding version we are given two numbers as input we need
to swap them and print the swap value outwards so we can return a pair of numbers. The video is a part
of data structures and algorithm in java by coding ninjas. The video was all about the introduction to
java video this was about a simple program in java. i would also suggest you to go to the code studio
platform according ninja the platform is free and it has free online editor and compiler in various
languages like python java. hit the bell icon thank you
,L2: Introduction To Data Structures In Java (In English) | Lesson 2
Data structures are just a particular way of organizing data in a computer simply that and why do we
need them because the amount of data is very huge so using different kinds of data structures according
to our needs becomes very important because it help us in storing the data efficiently and retrieving the
data quickly as well in future when we need to do something about the data. Some of the basic
operations that we can perform on these data structures are performed on dynamic data structures.
The next operation is insertion like in case of a linked list necklace necklace is like this. An array is just a
collection of similar type of data elements which are stored at contiguous memory locations. To declare
an array we should know two things first the size of the element and the data type if i know these two
things i can create an error and the syntax syntax is very easy. Areas store only similar type of data
elements which mean it will store the similar types of data types. The indexing of an array always starts
from 0.
The major advantage of using an array is that you can access any element in the array in order of 1. The
second advantage is that by making an array it saves the need of defining multiple variables for example
if i wanted to you know store five numbers i may use five variables a b c b integer of integer type only
and these five variables can store single single value. The other disadvantage is that if i have created an
array of five length or five size five but i just stored three elements in it the remaining two memory
locations are wasted. in a linked list is a separate entity which store two things the value of the element
itself and the address of the next element. Every node or an object in this linked list we stored two
values suppose it is storing a value of one this is story storing three and this is five in this seven now this
address part of this node will store the memory location of this. A linked list is dynamic insurance which
means the size of the link list can be changed according to our names. The second big advantage is that
there is no wastage of memory unlike arrays where if i have created an array of size 10 and i have added
only eight elements then the last two memory locations are getting wasted. If the head node head node
is the first node of the list and all the operations in the linked list are related to head.
stack stack is a linear data structure that works on lifoman and what is reason last in first out which
means the last element to enter the stack will be the first element to be removed from the stack. stack
stack works in this way so what are the prerequisites to declare a stack we should know the data type of
the element that we are going to store in the stack for example. The code is working fine earlier it was
not working because i was calculating the size after every pop element so the size was changing that's
why it did n't work properly so i just stored the initial size in length and then used that size to pop the
elements we can also use peak method which will only show us the top of the stack. The disadvantages
of a linked list the major advance disadvantage of sorry stack rather is that not much flexible because in
order of course this is the stack in order to get this element i 'll have to pop one by one on the top
elements. We should know the data type of the element that we are going to store let 's see the syntax
as well right queue data type variable name new here we do n't write queues we write linked list. The
, other operations which we want to do is when we. want to add an element in a cube we can use add
function you can simply write name dot and hello now this will add the element from the rear end
L3: Introduction to Algorithms in Java (In English)
Video is part of a new playlist on data structure and algorithm in java by coding ninjas. This video is a
part of the new playlist of videos on algorithms and data structure in java. In this video we 'll be
discussing what are algorithms some real-life scenarios of algorithms. Ad advantages of algorithms how
we can improve an algorithm why do we need algorithm? We want to find a way in which we are able to
find the meaning of our word in a very short amount of time all right. We observe that dictionary the
words of dictionary are sorted all right so using this observation we can improvise our algorithm so what
do i mean by that? We can simply remove the left hand side of our dictionary and we can only find for
the word said or whatever or our word with what we were looking for on the right hand side. In the
worst case the answer would be total number of pages that we have searched all the pages of the
dictionary.
In the worst case for a linear search we will see that we have searched a total of ten thousand pages but
in our cases we can see that after our first search we have divided basically let 's say x is total number of
pages of our dictionary. After the first search, we have basically decreased our pages to x y 2 in our
second search. In our third source we will decrease the total pages to x upon 2 to the power 3 so we can
generalize it by at our last search right. In the worst case when we were searching linearly we have to
search a total of 10 to the power 10 pages but if we do using an algorithm like this we will we only have
to. search 33 or 34 pages maximum all right and in our book of a total 10 000 pages we are only
searching for. is 33. 22. Algorithm is the best way to write algorithms in programming. The main two
important things about algorithm is to either increase the time or take less less space. We just want to
take less space as much as less as possible and we don't have any constraints of time we can take as
much time as we want all right so we have to focus on these two things either time or on space or both
of them also.
If you want to crack your next coding around what you can do is you can go to coding port studio
platform platform platform and here you can solve questions. The more you look at code the more
familiar you become with code that's why you have to see other people codes and how to write. We can
say that a number is even if after dividing by 2 a number gives us a remainder 0 then the number is
definitely even so to do that in programming in java basically in java specifically what we do is we can
write x percentage two so this will give us reminder a reminder of what we will get after we divide x by
2. The last step would be after reaching 10 and let 's say now we are at number 11 so we do n't want to
go 11 so basically after reaching the. We have developed steps something like this look at the number
from left to right check number is even or not. If the number is odd just skip that number just end the
search and we already have our answer all right so this is the step-by-step procedure for this algorithm.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller mdaatif363. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $8.09. You're not tied to anything after your purchase.