so in our previous class we have seen how to
work with array single dimensional and uh twood dimensional and today we will continue the topic
so we will see different type of examples and uh we'll see how we can solve different type of
problems using arrays so the most popular and most important uh programs is searching and sorting
so when I suppose if anybody ask want to ask any question from array con ccept definitely they
will ask about sorting and searching searching and sorting means array contains some of the
values and we have to print them in the sorted order and suppose sometimes if you want to search
an element in Array we should able to find or we should able to search an element or search a value
in a array so these are the popular programs most of the times people will ask in interview and at
the same time there are so many Logics are there so there is not only one or two ways there are so
many almost 10 to 15 different ways are there and searching and sorting elements like if you look at
a searching we have a linear search binary search and similarly if you want to sort we have a bubble
sort linear sort merge soft okay and there are so many different type of algorithms are there and
initially we don't need to learn everything so at least just learn one process the simplest way how
can we sort and such an element that is more than enough okay so later if you want to learn each
and everything I will share some of the links and you can learn yourself but initially whatever
is important as for interview so I will just try to cover those part so first let us see how we
can search an element in Array the for example one search an element in Array and basically this
is a uh linear search and this is a linear search algorithm there are different type of algorithms
this is the most popular one so linear search okay now we'll see how to search an element in an array
it's very simplest first we need to understand the logic so whenever you see problem statement
first time just read multiple times and once you read the problem statement then frame the
logic so suppose if you don't write a program directly don't write a program just think about
the logic manually how can we solve the problem okay and then try to put into the program so this
is a step by step process so search an element in Array first let us think about the logic so don't
directly go to program part and first let us see how can we search an element so if I give some
elements in Array how can we do the search if I ask you whether the element is present in Array
or not how can we how can we say this suppose let us say I have taken one array like this and I'll
put some elements in this I'll store some elements let us say randomly 300 500 100 200 600 like
this now my search element is let us say 100 100 is my search element now if I ask you this
100 is present in this array or not immediately you say yes and if I ask you 700 is present in
this array or not it will say no so on what basis and how we are saying 100 is present in this AR
and 700 is not present in AR how we are seeing on what basis immediately you can find right so
100 is nothing but 100 is a number if I look at here in AR there is an element 100 so immediately
can say 100 is present 700 is not present in you can simply say 700 is not present but how you are
saying and before saying 100 is yes what exactly you are doing okay what exactly you are doing in
this array so that is a main logic which which we need to frame that's the first step okay once you
understand the logic then you can easily implement the program so let me tell you the pro solution
here then we'll try to implement the first step whenever you want to find a number present
in this array or not first we have to read the first element from array and compare with
100 okay if both are equal that's fine if both are not equal then what we should do take another
element and compare with 100 again not equal then take another number and then compare with 100
so here it is matching and whenever the match is happened the exit from the for Loop and tell
element found okay element found so what exactly we doing here we are reading each and every value
from array that's the first thing by using F we can read right each and every value we can read
but as soon as you read a value immediately by using IF condition compare with your expected
number if expected number is found or equal then immediately exit from the follow Loop and number
is found if it is not matched then go with the next number like this till end of the array and
if none of them are not matching then finally we have to say element is not matching not for just
one number okay so you have to compare this number with all the numbers and if it is none of them
are not matched then only you have to say 100 is not found but simply in one statement itself
suppose 100 100 is not matched then immediately you should not say 100 is not present in this
array we should go with the next number and is still not matched then go with the next number
still not match then go to the next number next number and finally if not matching with any number
then only you have to say number is not found okay this is the logic now remember this this we have
to read all the data one by one that's the first step and parall as soon as you read some value
we have to compare with the expected number if matching immediately we can say element found and
exit from the F Loop because suppose here we found element do you really want to compare with the
rest of the numbers no need right because already matching is here so 100 is matched here so element
already found here so as soon as the element is found then we don't need to compare with the
rest of the number so immediately we break the loop right we will break the loop if element
not found then we will go to the next number next number like this depends upon the number of
values in Array we will repeat the loop this is the logic okay so once you understand the logic
now we will convert this into programming format so now let us try to implement program for that
go to eclipse and uh let's create new package for today new package today is day 17 click on fin all
right so now inside the day seven let's create a new class and searching me in Array there are many
ways to do this but this is one of the popular way so even though if you have a duplicate
values no problem wherever it is found the number immediately it will find okay and then exit
from the F Loop So This Is Our intention is not finding the duplicate numbers Our intention
is just check that number is present or not whether it can be one or it can be duplicated it
doesn't matter whether that number is present or not anywhere in in this array even though if you
have a duplicates which one is wherever you found the first element you can just match it and then
exit from the F rest of the numbers we know need to compare okay that's the reason we have to be
more clear about the problem statement here we are not talking about the duplication of elements here
we talking about the searching of element okay if you have 100 number we are we are searching and
100 is present in three times or two times and wherever it is matched first time we will compare
match is over then exit from the for Loop and INB say find the number okay we not concerning about
duplicates here we are just checking the element is present or not and finding the duplicate
is totally different concept different logic we need to so this is for searching an element
it can be single or it can be multiple numbers we don't bother whether finally we have to say
the number is present in area or not okay now so we'll do step by step listen this very carefully
because it is more logic oriented so in the next examples every example is purely logic based okay
so you need to carefully focus and listen this so first thing what we need to do is whenever
you want to find an element in Array first we need to create an array which should contain some
values right so let me create one array directly in a and directly I'm assigning the data into
array let's take 10 20 30 40 50 so the data is not in uh order we can put any numbers duplicates
random order assing desc whatever it may be you can put whatever numbers you want So currently
I'm taking 10 to 505 numbers now what is the element you want to search that also I can take
one variable enter search element search element so which element you want to search let's say
I want to find 30 is present or not I want to find 30 is present or not okay these are the
first initial things now let me start writing a looping statement so what we need to do now we
have to read each and every element in the array and compare with the expected element right
search element now let us start writing for Loop so you can write classic for Loop or you
can write enhanced F okay anything is fine so which one you will prefer so one F loop I will
show you another one you guys can try classic F Loop or enhanced F Loop so most of the times we
will follow enhanced fop but I will show you both of the them first let us start with the normal
fop okay so inter I equal to zero and how many times we have to repeat this five times we have
to repeat okay so less than or equal to now tell me here a do length or a do length minus one a do
length or a do length minus one so when I say less than or equal to you have to say length minus one
when I say just less than you can say a do length I hope this is clear yesterday we have discussed
elaborated I less than a do length and then i++ so I is representing index of array index start
from zero now we will read each and every value from ARR how to read it normally how to read print
can system print Ln a of I we can simply pass I value in every itation so first time I value zero
so a of I we will get 10 next round I value one so here A A of one 20 you will get next round I
value two then here a of two 20 30 you will get like this this Lo will repeat multiple times and
we are able to get all the values from array if I look at the output you can see we will able
to to read all the values one by one now this is not our requirement what is our requirement as
soon as we get a value we have to compare with our search element right so let's remove the print
statement now we need to compare this with our search element how to compare using IF condition
okay if if a of I and what is an operator we have to use to compare whether they are equal or not
we want to check equal to or double equal to yes double equal to is a comparison operator double
equal to search element search underscore element okay now if both are equal if both are equal then
what we should say we should simply say system. out. element found so as soon as element is found
you don't need to compare with the next values you don't need to compare with the rest of the values
in Array right after element is found so you don't need to repeat this Loop multiple times again when
you have to repeat this Loop if the element is not found then we have to repeat the loop and get each
and every element one after another but as soon as you found an element here so you don't need to go
with the next value but so now here I can simply say break why I'm saying break here because as
soon as you found an element in Array we need we know need to further repeat suppose here there
are elements let's say 10 20 30 40 50 now here I found an element and immediately I'll break the
loop and you can say element found so the rest of the numbers we don't need to compare because
as soon as you found an element that is our objective here so as soon as you found an element
that is found that's it you don't need to compare with the rest of the elements so immediately
say break so what this break command will do it will exit from this for Loop or it will break
the for Loop okay suppose if it is not matching if it is not matching then what we should say we
should go with the next element or immediately we should say not matched our element not found how
I told you one point here if the element is not found immediately we should not say element not
found okay if element is not found immediately we should not say we should also compare with the
next values after completion of all the values or after comparing with all the values finally we
have to say element not for not with just a number so if it is not matching if this element is not
matching with this number immediately we should not write else block like this okay write if you
write else block like this what will happen if the element is not matching then immediately in else
block we can immediately we will see element not for but that is not right right because we want
to check rest of the numbers after checking all the numbers then only finally we have to say
element not form immediately we should not say so else block we should not put here else block we
should not put here okay because if it is matching element F and many people think else element not
found if I put like this what will happen element not then what happens let's try to execute
and see so when a run has a Java application just observe the output see element not found
element not found and final element so what exactly Happening Here is if it is not matching
then L part will execute again it will go up not matching then again El part for every element we
are saying element not found element not f right so we should not say like this after comparison of
all the elements if no element is matching finally we have to say element not form only one time
right so immediately we should not write else block here we should remove this now when we have
to say element not found so after completion of the F Loop if I exit from this fop when this
F Loop will exit when this F Loop will exit in two cases what is the first case if element is
matching here it will tell element found and then it will automatically exit okay that is a one
case if element is found immediately the break command will come out from F Loop so F Loop will
exit that's the one case and what is the second case when F Loop will exit second case so it is
reading each and every value comparing with this number okay and no elements are matching so
none of the elements are matching and finally what happens it will compare with each and every
element and no element is matching and finally the F Loop will automatically exit after condition is
true the for Loop automatically exit right so two cases one is after matching is found after element
is found it will immediately exit second case is after completion of the all the numbers then it
will exit right but which case in which case we have to tell element not F if this Loop is exited
after completion of all the elements none of them are not matched then we will say element not form
so After exiting from the F Loop here I'm saying element not found just observe this okay element
not form okay let's try to execute the code and see how it will work run as Java application
see what is an output you are getting when I say 30 here the matching is done so element found
it is got printed break and it is exited from the for Loop After exiting from the for Loop the
next statement is there right so this is also got executed element not found is also executed
this is not the right one right suppose if I give something else let's say I'm giving 100 actually
this element is not there in the array and when I execute this saying element not found 100 is not
there in Array it is saying correctly so why it is saying correctly because after executing the
F Loop so there is no matching happened finally F Loop is exiting normally and here it is saying
element not found right this is okay fine but when you give the exist in value then we are facing
some error here just observe this okay run as Java application now what exactly happening here so
whenever the match is happened immediately saying element found and break the loop this is working
fine now we need to think about this one so After exiting from the F Loop After exiting the F Loop
we should say element not found okay that is fine but on what basis we have to check element not
found so we need something a temporary variable we require here because as soon as you match is
done you're simply saying element found and After exiting from the F Loop if I write the statement
the statement will every time will execute if the element found or element not found every time the
statement will execute but this statement should not execute every time okay so here we have to
use some variable temporary variable we have to use so Boolean variable we required so Boolean
variables will be used to maintain the status or sometimes we maintain the status or Flags Okay
so let me take one variable called status and let me Ascend false default Valu is false okay so
let us think false means not found true means F okay let us assume like this false means not F
okay and and true means fond let's think positive so let us assume false means status is equal
to false means not fond status equal to True means found okay let us assume like this take
one important variable initial variable status equal to false buan variable now what I will do
is as soon as you found element here okay before breaking I will change the status value is true
okay I will change the status value true because here we found an element okay as soon as you
found an element make the status value true so the existing value is what default value is what
false now as soon as you found an element I make status value true it is got changed after that it
is exited from the for Loop okay now you tell me After exiting the for Loop if the status value is
equal to true what does it mean After exiting the for Loop also status value Still Remains the
Same right initially it is false and when you are changing the Status value after element is
found then only we are changing the status of the status Valu is true so After exiting from the
F Loop if the status value is equal to true what does it mean element found okay After exiting
from the F Loop if the still status value is equal to false what does it mean After exiting
the front Loop if the status value Remains the Same same initially whatever value we have taken
false After exiting the for Loop also status value is still false what does it mean element not found
so that we need to compare After exiting from the for Loop here if status value is still false still
it is false then we have to say element not F only if condition okay so this variable is required
because as soon as element found we are making status equal to True okay it is got changed so
After exiting the for Loop if the status value still false then element not so element found is
decided here and making status is equal to true so if it is matching here this will not match if
this is not matching for every element and this is matched wice Versa okay this is for positive
condition this is for negative condition if the status value got changed here this condition Falls
obviously right so now you'll get the right output so you can say I'm taking 30 is a search element
so when I run this as a Java application now we can see element found now let us take 300 when
I run this as Java application element not found okay so this is a solution for this so we have
to take the help of a Boolean variable somebody asked in the previous sessions where we can
use Boolean variables so this is a use case and many places we require Boolean variables and
especially while using conditions also these are all Boolean stuff actually so this conditions if
condition for loop everything will return true or false right they are all Boolean variables so
this is how we can solve the problem so if the element found immediately say element found
make the status true and break the Lo and if the status still false then element not okay so
this is how we can do searching search an element in this is called linear searching algorithm so
linear means every element we are comparing for every element we are comparing and same thing we
can achieve by using enhanced for Loop also it is exactly the same no change even this if condition
everything is same instead of normal for loop I can write enhanced for Loop so let me just comment
this for Loop and let me write hased problem it's more simpler than above can simply read each and
every value from array how to read simply specify the array Name colon and here we need a variable
which will hold the values from array 1 by one in some X okay now condition same thing we can
compare so let's take this and keep it here so here we do not have index so directly take X
okay if this x value equal to search element element found status true and break okay so this
is how we can simply write enhancer for Loop and then if condition is as we show so this will
also works so element not form so let's take 30 element form perfectly working
suppose if you have a duplicates how it will work let me show you
let's say I'm taking 30 here and one more 30 so we have three elements 30s
are three let's try to execute run as Java application you can see element F only one time
you will get because as soon as you f element here it will exit from the for Loop and rest of
the things it will not verify it will not check okay so this is how we can find search an element
in a okay suppose if you want to find how many times it is repeated suppose here 30 is repeated
three times and 10 is repeated only one time 20 is repeated only one time so how can we find out
so that's a totally different logic so how to find element how many times the element is repeated
how many times the element is duplicated so that we will try to find out okay somebody ask this
question so the next example example two so the first example is clear everyone please confirm in
the chat box searching an element in a logic you have to be understand first if you not understood
the logic you can't understand the problem okay now so let's move on to the next one we have seen
how to search an element in Array even though if you have a duplicate elements in Array no problem
you can easily find out now the second example how can we find repeated number suppose if I give
some number I will store some numbers in Array and I will just check particular number how many
times it is got repeated so that is my problem statement okay so find number of reputations okay so find the number of reputations
so for example first again think about the logic so don't directly write a program first thing
about the logic let's say I have an array like this and we store some values in it and this
time we should maintain some duplicate numbers also let's say here 10 20 10 10 and 10 so now
I want to check 10 how many times it has got repeated how many tens are there in this array
or how many 20s are there in this array I want to verify so initially let me take one number
so how many times the 10 is got repeated how we will tell he will compare it right he will
take first read one number compare with this okay it is matching so first time compared one is
there second time read another number compare not matching second third time read another number
compare here another matching is happen so now it becomes two so now another number is also 10
and compared matching has happened now here this becomes three three times it is repeated now one
more number is 10 and compare so again matching is happened so then it becomes four four times
is repeated and then next number not matched so then exit from the for Loop so in whenever the
matching is happened we have to increase number of counts so we will take one initial variable
called count and as soon as you compare every time you will compare as soon as the match is
happened we will increase this count variable okay and once the loop is completed finally
this count variable contains how many number of times that number is got repeated how many
duplicates are there in this particular array so we need to maintain this count variable
this is exactly same as almost searching an element but in the searching element as soon
as the element is got matched immediately we are breaking the loop but here we don't break
the loop instead of breaking the loop we will increase the count value initially we will
take count equal to zero and as soon as the match is Happ immediately we will increase
the count value by one like this okay After exiting from the follow finally we will check
how many values we have in the count variable that is a logic which we have to implement okay
now let's go to Eclipse take another class this is almost equal to search an element but slight
change we have to do okay so number of repetion or else we can simply say find how many duplicates in arring okay this is
more clear how many find how many duplicates in a r okay so now the first step we have to create
one array which should contains some data okay so let me create one array here I can say int
a equal to uh I can say some numbers let's say 100 200 again 100 300 again 100 4 100 again
100 okay this is my array now 100 is duplicated three times okay so now we'll find how many times
100 is got repeated how many times 100 is is got repeated so let me first write the F Loop so I
can directly write enhanced F Loop you can try normal for Loop okay so I'm taking a I'm reading
each and every value into variable in some value some variable then if I print this value it will
print all the values from array so it will print all the values from array which includes all the
duplicates everything is got printed everything is got printed okay now we need to find find how
many times 100 is got repeated okay so that number we can take a separate integer number equal to 100
so now we need to find how many times this number is repeated so now what we need to do is instead
of printing this value we will just compare if this value okay equal to number okay then what we
have to do we have to take One external variable count variable initially let's make it as a zero
this is an integer variable count is required so as soon as you found a value or as soon as you
found an value in ARR immediately increase the count value by one count Plus+ increase the count
value by one okay now how it is going to execute first 100 will store in value and 100 equal 100
is true now what is the count value what is the count value one okay now again it will go up take
another number 200 store into value now again compare 200 equal to 100 not matched so again it
will go up so whenever the match is happened then only count value will be increased otherwise no
so it will go up again 100 again one more 100 we got here so again comparison is true so initially
count value one here now it becomes two because we found one more 100 now again it will go up and
take another value 300 not matched now again one more 100 we got so condition matched so the count
value will be increased by one so now it becomes three so how many hundreds are there those many
times this if condition becomes true and those many times this count value will be increased by
one every time whenever you found that element it will increase by one so finally if you come
out from this follow just try to print the count variable that includes or that contains the total
number of reputations how many times that number is got repeated so the count is representing right
every time you found that number we increasing this so finally the count contains a total number
of elements how many times that element is got repeated so when I run this you will get exactly
four times so there are 400s are there one 2 3 and four okay now let us take 200 now I want to find
how many 200 are there let's make 200 now so how many times the 200 is repeated how many times
the 200 is got repeated two times here it is one and here it is two okay so this is how we can
simply find how many duplicate numbers are present in this AR okay so we can write we can Implement
so many Logics guys this is never ending process there are so many things so why we have uh why
have you used number variable instead of using value 100 okay duplicate values where here I
have used number only value equal to number I've taken this number variable okay so whichever
number you want to find duplicates you can just put that number here and that number variable
I'm using here I think you not properly see so value equal to number here I'm not hardcoded
the value I have taken the number variable here okay and you can directly put the number
also no problem suppose if you have a specific to number suppose I want to find how many
times 100 is got repeated you specific to number then you can directly write a number
here no problem okay you can directly number so you don't need this variable you don't
need this number variable that okay then this becomes a static because this will work
only for 100 okay later if you want to check another number how many times repeated
again you have to change if condition here so instead of doing this we can just
create one variable number and that you can specify okay yes can we use the same logic when there
are multiple different values yes just now I have shown you right how many times 100 is got
repeated how many times 200 is got repeated and remember all the values should be numbers because
array is a homogeneous data not heterogeneous data so every uh value should be having same data
type and even if you have a different types you can still verify it by creating object type
of an array okay multiple different values also we can have but in that case you have to take the
object type of an array then you can find it right so this is one example how to check how many
array variables exist how many array variables exist in a variable in a program you guys can try
so here how many array variables I have created a is one array variable so there is no specific
Logic for that actually so the variables will be defined by whom who will create a variables
who will create a variables the user right the program will create a variables so the time of
creating the variables itself he has to aware where we have to create an array variable where
we have to create a normal variable so variables will be used for operations that's the actual
intention okay the variables we will use for operations and we no need to count how many
variables are there how many array variables are there not like that but we can check suppose
if there is a a variable that that variable is a normal variable or array variable that we can
check but in a program how many array variables are there how many normal variables are there
we cannot check like that okay but just tell me what exact requirement so accordingly we can
TR the different logic but this is not possible okay all right so we have seen search an element
and now we will see sorting example three sorting and this sorting is very big concept guys
there are almost 10 to 15 algorithms are there for sorting we can do different ways the N
number of algorithms are there but uh now we are not going to learn each and everything I will
show you one simplest way of sorting an array by using a built-in methods okay and if you still
interested to learn all those sorting algorithms but programming level that is important but we
we don't need need that much actually but the programmers developers they have to learn
all algorithms concept time complexity all those things okay but we are not going in that
concept just we'll try to understand how what is sorting and how can we sort array elements in
the simplest way it can be number array or it can be string array whatever it is we will able
to sort and there are multiple ways are there bubble soft merge sort linear sort insertion
sort transition sort okay there are 10 to 15 algorithms are there so if you really want to
learn all those algorithms I will share some links at the end of the session and you can go
through and learn but I'm not recommending at this point of time just first be familiar with
the simple Concepts the basic concepts and once you familiar with all the concepts then you can
go with a little bit advanced stuff okay but if you look at the Sorting techniques and everything
you will be confused totally first of all you may not be able to understand okay very complex
so simple simplest way I'll show you how we can sort an elements in an array so let's take
a new class sorting elements sorting elements in Array so you can practice hundred thousands of
programs based on this topic guys so it's very difficult to discuss each and every example I'll
show some example if you know how to use an array that is more than one so how searching will work
in two Dimension array so you guys can practice all those things okay it will also you can also
search an element in two Dimension so that is also possible you can read each and every value from
two Dimension AR and you can check if condition you can keep if condition same thing actually
no there is no much difference only thing is you need to write another for Loop two different
for Loops you have to write so you already know how to read the the value from two Dimension are
right how to read values from two Dimension are yesterday we already done this see if we go back
to the yesterday session two Dimension are so by using this for Loop or enhanced for Loop or
normal for Loop you already know how to read the element here we are printing that elements
from two Dimension so instead of printing here you can just put if condition if this particular
value equal to our expected value then element found and exit from this F Loop if you put
break command inside this for Loop it will automatically exit from Outer for Loop also so
here instead of print statement you can just put one condition if condition if this number is
matching with our expected number and immediately change the status tag equal to true and break
the loop after come come out from the break for Loop you can put another condition if the status
value still Falls then element is not found same logic no change only thing is you need to write
another for that's it you guys can try if you want okay it's very simple actually it's not much
complicated all right now we'll see how can we sort an elements yes sorting means yes ascending
or descending order we can print the numbers in ascending or descending order right so first of
all uh let us see how can we sort the elements it can be number or it can be string whatever it
may be we can do it and but this is a simplest way by using built-in methods I'm going to
show you but if you want to sort in desing order in whichever way you want order but we
need to write a different type of algorithms okay let's try this first and before sarting we
need to take one array concept right we need to store some elements in Array let's take one
array and uh in this I'm going to store the numbers in random order not exactly in the sorted
order random order then only we will know AR is sorted or not so I'm taking 100 600 then 200 500
and then 400 so now I'm taking these numbers in the random order it is not ascending order this
is not a descending order so randomly I've taken this number 200 let's take 400 here and 500 okay
now I want to print this array in sorted order so before printing this array in a sorted order just
print this array as it is first before sorting I will print element after sorting also I will print
the element so that we can see exact difference so if you want to print this array system print
so how we can print before sorting I'm writing xcept before sorting so before sorting I'm just
directly printing this array by using enhanced for Loop we can just try to print so a is my array
I'm taking this into value and after that I'm just trying to print value so this will print all the
elements from array before sorting before sorting means the original array so this is the order of
elements these are the order of elements okay and suppose sometimes if you want to print all the
numbers just for printing purpose you don't need to write a looping statement okay why we need to
go with the looping statement because if you want to read individual values one by one then you
can write a looping statement so that we will get each and every value individually but I don't
want to read individually I want to read all the array elements in one single statement and later
I don't want to perform any task just for printing purpose okay then you have one shortcut method
instead of writing this F Loop what we can do is we can directly print all array elements using
one method here that is system. pin and here I can say there is a predefined class called
arrays arrays is one of the predefined class arrays dot in this there is a method called
two string okay two string and uh in this we have to pass name of the array and this is one
method which is available in Java right instead of writing this for Loop if you want to print all
the array elements you can use this method arrays is a uppercase character arrays dot two string
of a what is a here a is a name of the array the variable name of the array so this will print all
the array elements in the form of set when I run this Java application so you will get all the
numbers like this EXA in Array format okay so this is a shortcut and uh it is just for printing
because it is collectively printed all the values vales so again we if you want to perform task
any operation individual numbers we cannot do here because this is all one set right if you
want to perform any operations in this then we have to write a looping statement and read
individual values and then you can perform some operations so this is just for printing purpose
we can use this statement Aras do two string of a and we don't need F Lo okay simply you can remove
this or else no problem so before sorting these are the numbers currently I have now we want to
sort this array and to sort this array again we have to use arrays class in this there is a method
available called arrays do sort this is a method array dot sort in this we have to just pass array
name so whichever array you want to start you have to specify and one more thing whenever you're
trying to access some external classes aray is a another class actually so we have to import
one package import to java.util.arrays actually this is a package concept the coming sessions I
will explain in detail so for now just understand whenever you refer any external classes we have
to import required package so this array class is present inside java.util package these are
all predefined packages and classes in Java they already developed in Java so we are just
trying to use it okay so this import statement must be present whenever use this arrays class
okay if you're not writing this manually it will automatically suggest you so if I look at here it
is giving some error right when you put the cursor in arrays it will show you some import statement
here import arrays java. just click on this link it will automatically import like this okay so
this particular statement will sort elements sort elements in Array so we already printed these
array elements before sorting now here we have done sorting so once we have done this sorting
then we will print the values again one more time so I'm executing the same two statements one
more time after sorting so here I will just say after sorting again array. two string of eight
right so before starting and here we are doing sorting of elements and then we are printing
after sorting let's try to execute run as Java application yes now we can see this is a before
sorting elements and these are the after sorting 100 200 four five and 600 okay so the same
technique is applicable for Strings also we can also simply sort strings let me show you
another example sorting strings we have to create array which contains strings multiple
strings sorting strings take main method say finish okay so now let us take can we use arrays.
two string method to printing string array yes you can print whatever array you want by using
arrays. two string method let me try to use now I going to show you that okay so let's create one
string array string as equal to you can take any type of sing s equal to and here I will take
some type of string data so here this method is not allowing a decreasing order that is your
descending order and if you want to print the descending order you have to write a different
type of logic okay this particular method sort method is not allowed to uh print numbers in the
descending order okay uh I I'll try to find out maybe for Strings it is possible or maybe the
numbers it is possible so let me cross check okay otherwise we have to write a logic separate
Logic for that okay so let us see how can we sort the string so string is bracket equal to let me
take some strings here see if it is a number we can sort but how can we sort strings and how we
will know which string is higher which string is lower if it is a string how can we sort see if
I give a b c is one string okay XY Z one if I ask you which one is the higher which one is the
lowest s how we will tell if it is a number we can simply say lowest number highest number but
if it is a string how can we do this yes so how it will check whether which one is greater or not
first it will check the first character here it is a here it is X alphabetical order okay it
will check alphabetical order so here first character is what a here is first character
is X and which one is highest and which one is lowest a is the lowest so obviously ABC is
the largest suppose if the first character is same first character is same then it will go to
and compare the second character here it is a b here it is Y which one is the largest Y is the
largest largest string okay ABC is not largest okay like this first it will check alphabetical
first character is equal or not if it is equal then second character if it is equal then
third character so it basically checks the uh characters alphabetical order okay let's try
to take this numbers so first of all let's take a BC and single characters and then we will try to
apply uh strings let me take something called a c b okay and here I can say d d c b a okay let's
say take Single Character we will check whether it is sorting in alphabetical order or not okay
so now Tak an string and is it correct notation can we put characters in The Double quotes yes
or no can we put characters in The Double quotes yes okay yes and uh can we put this character
because they are single characters can we put in the single PS like this can we put single
course because if they are the characters right yes we can put but the type of this
array should be what G type of an array okay if you take care type of an array we can
simply create so let us try this first let us sort this array so again I'm just trying to
print before sorting before sorting I'm just trying to print how to print before sorting
okay I can directly put like this in writing another statement here itself before sorting
concatenation and which class we have to use arras do two Stringer arras do two string of
what name of the array is what yes okay that is a before sorting now I'm going to sort arrays
dot do sort of yes so this command will sort the elements now after that again I'm printing after
sting after sting okay same thing let's try to execute okay now we can see it is sorted
in descending order a b c d so we have successfully sorted character array let us
try to sort string type of an array okay so let me take a string yes equal to the
bracket first string I'm taking squ second string second string Mar and the third Stringer John then fourth
Stringer David so let's take some random string like this this is my array four elements
are there now let us see before sorting after sorting yeah so you can see this is the before
sorting and this is the after sorting so first D comes into picture right so D first character is
D first lowest so D next J and then M next Scot yes so even first cars itself it is matched in
alphab Bas alphabetical order it is got sorted so this is how we can simply do the sorting
by using buil-in methods okay sorting of you can do numbers sorting you can do characters you
can do strings of sorting any type of data this method works okay so this method Works erase.
two string method Works to print arrays any type of array you can print and the sort method
is applicable for all kinds of arrays it can be string type of data or character buole whatever
it is you will able to sort it okay so this is one example now uh the next example example four so print
array elements print array elements in reverse order I just want to print array elements in the
reverse order so reverse order is nothing but in whichever order we have we have to just
reverse order we have to print that means reversing an array we can just simply reverse
an array okay so first let us think about the logic how to print elements in the reverse order
how to print an elements in reverse order let's say first I'll take one array like this and I'll
store some values let's say 1 2 3 4 order is not important you can put any number of orders
whichever order you want random numbers no insues now I want to if I print this array all
the values one by one how we will print first it will print one then two three four five by
using for Loop we will read one by one like this but now I want to print at the from the
bottom in the reverse order okay so how can we print we have to start from here and then we
have to decrease every time in every itation till we go to zero element right so this is the
logic we have to uh apply okay now we'll try to implement okay reverse an array so an array
we have to reverse reverse in the sense we will print all the elements in the reverse
order okay now first we have to take one array variable again it can be string array character
array number array whatever you want or it can be object array no problem okay so let me take
one integer in a so here I'm taking 2 3 4 five six okay let's take five you can take anything
you can change these numbers later so this is my array now I want to print this numbers in
the descending order or you can take another numbers 100 200 because 1 2 3 4 we will
represent with the index number right so let's take a different numbers 300 400 and then
500 okay now if you want to print these numbers in the reverse order and arase do two string
method will display these numbers in as it is same order it cannot reverse now we have to
write a logic for this to print this numbers in the reverse order we have to use classic for
Loop enhanced for Loops won't work okay because enhanced for Loop will read the values one by one
from the beginning itself okay enhanced for won't work here so we have to read the values from the
end so only through index it is possible right so we have to write one F Loop like this
for now tell me what is an index starting index see this is my array and in this we have
these numbers 1 2 3 1 2 3 4 5 so here we have 100 200 300 400 500 this is 0 1 2 three and four
now we have to read from here B to bottom to top now tell me what is I value starting from so here
we have to start I value equal to what equal to what so normally we will start from zero right if
you want to read the data from top to bottom now we have to read the data from bottom to top now
what will be the I value here what will be the I value starting point is this one what will be
the I value how we will know the starting point first of all okay we don't know starting point
so dynamically we have to get so if you want to know this index is a starting point how we will
know this dynamically a do length minus one a do length will give you four a do length will give
you five 5 - one four that is exactly equal to the last index so we have to start from here right so
then here the I value should be what a DOT length minus one that is a initial I value then what is
the condition what is this condition condition I'm talking so when we have to stop reputation so
anyway I value will decrease okay I value here index will decrease minus minus I we will do but
when we will stop as soon as I value becomes zero as soon as I value becomes zero we will stop or
we can write multiple condition I value zero then we can stop so even I value zero also we should
get right so we should not say equal to I should be greater than what is the condition I should be
always greater than zero only because here these are all indexes 4 3 2 1 all are greater than zero
or not yes I greater than Z even equal to also we should put so I greater than or equal to Z this
is a condition equal to also zero also we should get so the condition is what I greater than or
equal to Z then plus plus or minus minus minus minus because we have to reduce this value
minus minus minus okay so int data type also we have to specify here int like this this is
how we can write the conditions now just print the I value here how to print I value a of I
values we want to print so a of I right so then execute okay now we can see these are the initial
values 100 3 4 5 and now we got a descending order right so this is how we can print array
elements in the reverse order okay now these are few examples and some of them I will give you
as an assignment you guys can try and uh before that how to read data into array at runtime okay
so how can we take the input from the keyboard so as of now what we are doing if you want to create
an array we are just creating and we are directly assigning the data now my requirement is I want
to provide this data in runtime that means once you run your program or once you executed your
program it should ask enter this number enter the position then that number should go and add
into that particular position in the array okay so now we'll see how can we read the input from
the keyboard or how to read the input from the console and runtime and once you understand that
then we will see how to read the data into array how can we store the data into array in runtime
because this is most uh popular use case and very important because many numbers dynamically
we should provide at the run time instead of hardcoding this data okay now let us see how to
take input from the keyboard at the run time how to read the data in runtime first we will check we
will see the small numbers and then we will come to the array part again so here taking input from
keyboard keyboard in the sense from the console okay in the console normally we are able to see
the result or output we are able to see in the console window so now we are able to provide the
input also we can also provide the input from the console that is your keyboard taking input from
the keyboard take this main method and say finish and different data type also we can accept I'll
tell you how to take a different types because depends on the data type you have to change the
methods right so normally what you will do is you can say suppose integer number equal to 20 I'm
taking and immediately I'm trying to I'm trying to print this number is equal to 20 so this is
hardcoded value sorry it is number so what is this number number is a hardcoded value we already
hardcoded this value here and we are just printing but instead of hardcoding this value here I just
want to take this number from the console window so that I can provide different numbers and you
can test with the different numbers okay so to do this what we can do is instead of hardcoded this
value this is called hardcoded value instead of doing this I want to take this number from the
console window at the runtime okay so for that we have a special class is available in Java
which is also buil-in class which is scanner class okay scanner so whenever you want to use any
class we have to create one object for this okay at this point you won't understand what is class
and object all those things coming sessions you will understand but for now just follow blindly
whatever I'm saying scanner equal to new scanner and inside this we have to pass one parameter
that is called system.in because we are taking input from the system so we have to pass input so
this is a statement so whenever you are using any external class we have to import that particular
class how to import when you place the cursor on it it will show you import scanner of java.util
just click on this link so it is got imported java.util scanner got inputed now this error is
gone so this is a first statement so whenever you want to take any input from the keyboard or
console you have to create scanner class object so this is how we can create scanner class object
scanner this variable is can be anything you can put a BC or XY Z whatever this is just a variable
name so scanner equal to new scanner this is the first statement Now by using the scanner object we
can take the input from the keyboard so how can we take SCA dot so what type of data you want to take
that we have to be clear first integer type of data I want to capture so SE dot next in this is
the method you have to use if you want to accept integer data from the keyboard or from the console
you have to use next int and uh this will ask you to provide the value this will expect the value
from keyboard or console once you provided the value that I'm going to store in a variable like
this okay so this command will take the value from the console that I'm storing into this variable
and then again I'm printing this value so this is how we can do it so first scanner class object we
have to create like this scanner is equal to new scanner system do in is a parameter by using this
scanner object we can call one method called Next in so this will accept a numeric data only without
decimals and that I can store in the number and that I'm directly printing or you can perform any
type of operations so let me try to run this and just observe what will happen yeah so actually
the cursor is waiting in the console window it is still in running mode you can see in the red
color Mark here it is running but do you know exactly what it is doing it is not asking for
any input actually but it is waiting for input we don't know whether it is waiting for water or
not but it is waiting for input so if you provide some input like this I'm passing 100 here in the
console window I'm typing 100 when you press enter now we can see we got 100 as an output so this 100
whatever you Pro Ed here that is taken by this sc. next in put that number in this number variable
then this command is got printed same number value okay but if you look at here when you run this
program do you know exactly it is waiting for the number or not you don't know right so what we
can do is simply you can write one simple message here so before taking this number you can just
write one print statement so that you as a user we will know you can say enter a number enter a
number okay so now when I run this it will print as it is in the console window now we can see
enter a number so whatever is put in the double quotes exactly printed now we will know exactly
it is asking for the number so put the cursor here and then provide the value like this and press
enter now we got the number okay so this is how we can take a number input from the console window
by using next in this is not mandatory statement but in the runtime it will be more clear because
as a user we have to know whether we have to pass a number or string or character whatever so if you
write this message clearly you will exactly know okay and also at the time of print we can make
more sensitive I can say given number is and then I'm printting this number it will be more clear
now it is asking enter a number I'm saying 50 now given number is 50 so like this we can take
input from the console window at runtime and we can store into some variable and then we can print
this number as it is so if it is a number we have to do like this now let me take some other type
of data this is for number okay now how to take decimal number if it is a take decimal number same
scanner class this we won't change okay so decimal number how can we take so let me put one more
system. print and I'm asking user to enter decimal number enter a decimal number now how to take the
decimal number SE dot here we use next in now this time here we have to use SE do next Double next
Double so this will take the decimal number data and we have to store in a variable now what is the
type of this number variable now what's the data type of this obviously it should be double type
right because we are accepting double type of data and we are storing into a number that variable
also should be double type of variable right now I can just print this given value s given value
s or can just print number okay let's try to execute so now this time it is asking for decimal
number so I'm just providing some decimal number let's say 10.5 decimal number given value is 10.5
so decimal number is asked okay for example even though it is asking for decimal I'm just passing
an integer value will it work or not can you guess will it work or not I'm just giving only integer
instead of double I'm just providing an integer will it work or not 10.0 okay because we have
taken that as a double so it is accepted but it is additionally added do0 so same only right
so 10 10.0 no difference it is just added to a decimal point zero that's it so because both
are number type of data so it is accepted no problem okay now we'll see the vice versa let's
say I'm taking integer here in the first example let us enable this okay now here we have to pass
an integer actually right as for next we have to pass integer but now I'm passing a decimal number
passing decimal number will it accept or not will it accept or not exception input mismatch
exception and what we need to understand based on this integer data type variables cannot
hold decimal numbers whereas decimal data type variables can hold integer values okay that
is a point so now we have seen how to take integers and how to take decimals but how to
take string how to take a string so let's see this because string is little bit different okay
so let me just say system P enter your city okay so just I'm giving some message enter your city
so normally city is what string only right that I'm I'm going to store in a variable so now what
is the type of the variable it should be string type of variable right string City equal to Sea
Dot now here we used next in here it is a next Double but here what is a method we have to use
we do not have next string we don't have a next string just we have to call only next that's
it just next so this will take the string and store into city city is a string variable now I'm
going to print here system print I can just print city as and close and just print City so this
is how we can take string type of data for all other data types there are methods are there
like string next in for integer next Double is for decimal next float is also there next Bull
is also there next car is also there okay but for Strings we have only this one SC do next same
scanner object we have to use to access these methods okay so can we have one single scanner
class for all yes we can have no problem same object we can use for all kinds of data types okay
but the variables should be different because here we are taking integer the variable should be
integer type here we are taking decimal the should be double type here we're taking string
the variable should be string type same variable we cannot use for multiple data types okay so now
execute so it is asking for enter a city okay now I'm entering some City Delhi let's say your city
is Delhi so like this we can provide the input from the keyboard or console and we can see output
in the console itself console is for not only for providing output it is also used for providing
input and by using scanner class is this clear everyone how to take input from the keyboard now
we will apply the same concept for arrays can we enter multiple yes that's I'm coming to that
part yes we can also provide multiple inputs yes it is possible I will show you in the next
example so before that is it clear first of all how to create a scanner class object and how
to use scanner class object to take the input from the console integers decimals strings
anything you can take okay now let us try to take multiple values how to take multiple values
from the console window let's take another class taking multiple inputs from keyboard or console
taking multiple inputs from keyboard or console take this main method okay now process is
exactly the same okay now what I will do is this time I will take two inputs from the
console or keyboard then I will perform some operation on those two values so now tell me what
is the first step what is the first step we have to create scanner class object that's the first
step okay scanner is equal to new scanner inside the scanner we have to pass one parameter system.
in so whenever you write this we have to import this scanner class from java.util package done
and sometimes if this popup is not coming like Auto s is not coming you can directly manually
write this statement okay sometimes you may not get this Auto because we need to do some setting
in Eclipse okay if there is any problem but that is not a blocker actually okay if not able
to see the suggestions like this you can try to write this manually no problem so now let us
take some values from the keyboard now the first value I'm taking from the console system print
I'm asking enter first number first number I'm asking first number to enter so how to take this
first number SE dot next in and that I'm going to store in one variable int number one first number
accepted now I'll ask another number system print enter enter second number enter second number and
that I'm going to take another same object SE do next enter same type of data that I'm going
to store in another variable int number two okay into object means you can provide any dep
no issues so here uh okay let me come to that point first let me finish this okay so number
one and number two so we have taken two numbers now so here we are taken number one here we have
taken number two so now we want to perform some operation let's try to add those numbers and say
number one plus number two this is addition of two numbers and gation and put
this expression in Brackets okay right so this is how we can take
multiple input so this is first input I'm taking second input and then perform
the operation okay let us try this run as Java application yeah enter first number
100 second number 200 now addition of two numbers is 300 so you can also pass multiple
numbers like this okay suppose if you want to pass different data types like 100 next
one is a name some string country address phone number okay different type of data
if you want to pass then you have to use a different type of methods okay so for example
let me take another example this is example one okay so now the first input enter name enter name okay name is nothing but what
string right so SE do next this will take the string and store in the string variable string
name equal to next and then you can print so your name is can just print name so this is how we can
take the name so now what is the next value let's take a number so suppose four number so let's take
four number then SE DOT phone number phone number is what yeah or age you can take age SE dot next
in age is also number right so this time we have to take next in so here age is a number so int age
now we can just print this okay your age is can just print age but before that we have to print
one more statement so here enter your age like this so name we have taken which is string age we
have taken which is number okay so like this we can accept any type of data so depends upon the
number number but this is object in the sense object is a totally different type okay suppose if
it is a variable object then how can we take for example let's say uh system do out. println enter
uh unknown type suppose unknown value unknown value means it can be integer it can be double
or it can be string whatever it is unknown value value so that unknown value have to take into
variable some variable you have to take so we don't know what is the type of unknown value right
it can be integer it can be number whatever it is we don't know so let's take an object variable
object okay and say value equal to s dot now this is a challenging thing so which method we have to
use because we are providing some unknown value we don't know whether it is integer or string or
decimal we don't know exactly right so in those case also we have to use just next method because
this next method will take anything as a string format anything as a string format it can even if
you provide the number decimal character string whatever everything will be converted into string
format and the object variable right this variable can hold any type of data but later if you want
to perform any operations on the numbers we have to convert the string to number again because
we cannot perform arithmetic operations on the string data types so we have to convert the string
format to number format and then we will able to perform the operations okay so it can take like
this and then uh you can print this system. print LM you can just print value okay just observe
here okay now I'm executed so so enter a name say John this is obviously string your name is
John enter a age let's say 30 your age is 30 now enter unknown value so unknown value means it
can be anything even though we use next method that will accept all kinds of data but everything
should be in string format so even if you provide 100 I'm providing will it take or not here I'm
using next normally it is for string but here we are providing 100 will it take or not will it
take or not yes it will take okay it will take 100 and how in which format it will take because
we use next even though we provide the number it will take that number as a string actually 100 is
a string not a number okay so this is how we can handle object once you once you get this number
as a string later we have to convert that into again number format then only we can perform
the operation okay so that is again different process what if I want to accept care or bullion
yes you have methods next car is method is there so you can see here SE dot next care sorry dot
I think for next car is not there but for that you can use again string method next method but
rest of the rest of the data types you have all the methods you can see next Boolean is there
okay next next to double next float next int so for every type we have methods next long
next short for all primitive data types these methods are available so you have to just change
this method according to your value if it is a Boolean we have a next Boolean also you can see
this is the next Boolean so you can also accept Boolean data so just you need to change this
method okay so for almost every data type there is a specific method as there and if there is no
specific method you can use this next method for all kinds of data types you can if you use next
you can provide string you can provide number you can provide character you can provide P all
kinds of data you can pass okay so finally we will apply the same concept for arrays so now my
requirement is I will create one empty array then I will fill the data into array by taking
input from the user at the run time I will take the input and store the data in Array and
after that I will print array elements the last example okay so here the name
is reading and writing data into array reading and writing data into array okay
now earlier if you want to add some data into array we have two approaches right so what are
those two approaches the first approach is what int a equal to new int here we specify size of
an array and then we can add some data like a of zer 100 and then a of two a of 1 is equal
to 100 so like this we have added this is one notation right so now this time I and another
way is what I can directly write this a bracket equal to in the cly braces we directly specify
the values like this this is another approach we have followed now my requirement is I will
just create an array without any content just create one empty array and five inputs I can
store but those five inputs should come from the keyboard or should come from the console
in runtime okay so I will take five different values and I will store those five different
values in this five positions that is called reading data into array and once you added
all the data into array then I will write the same data in the console window that's
my objective okay so let's start with this first what we need to do we need to take a
scanner class scanner ESC equal to new scanner system.in system. in we have to import this
scanner class okay now so this time we have to take multiple inputs see very simple if you
want to take five input from the user if you look at my previous example different statements
we have to write so this is for one input this is for second input so in Array we have to store
five elements so we have to write five times the same statement you have to repeat five times
right enter first number second number third number fourth number and if you don't know the
size of an array we don't know how many times we have to ask input from the user right so instead
of writing this next in methods multiple times we just write one for Loop and repeat that multiple
times okay so let me just say for I'm starting array index start from what zero only right
I equal to zero and how many times it should repeat depends upon the size of an array so I
less than I less than a DOT length and every time I'll increase I value index value will be
increased by one so now we need to ask the numbers from the keyboard or user so first value second
value third value and so on so here I'm asking system.out.print enter enter a number enter
a number or you can say enter a value and once you take how to take the value from the
keyboard SE dot next in next int so that I'm going to store and where you have to store this
value okay we are taking input from the keyboard from the user where we have to store in Array
we have to store again in Array where we have to store because we have a multiple indexes
so in Array we have a five locations in which location we want to store suppose this is my
array 0 1 2 3 4 five so now first value are entering in which position we want to store
in the first position next round of iteration we will take another number where you have to
store second position then third position four like this we have to store so how to decide in
which position we want to store the value a of I just simply pass I value here okay so that
a i representing the index location so the first value will store in the first position
okay and next round it will iterate again it will ask another value in another position next
round again it will ask another value in another position so once this Loop is completed all
the data will be stored in Array okay then we will try to print this array let's try to print
system do printing printing array elements so how to print this array elements same thing again
same for Loop or you can also use array arrays do two string method directly if you don't want
to use a looping statement you can simply say printing array elements arrays dot two string
of a which is array name okay now let us try to execute yeah enter a value 10 enter value 20
enter value 30 enter value 40 Enter value 15 done so we have added all the numbers and dis
printed array and if you look at this output every time it is asking just enter a value but
we don't know in which position that value is going to store right in which position it is
asking for we don't know so we can write more meaningful message enter a value enter a value
or which value in which location enter a value for the position for the position which position
I I representing the position right position of I concatenation like this okay and then put column
like this so that we will be more clear in which position it is asking for the element enter value
for the position okay now execute it will be more meaningful observe now we can see enter the value
for the position zero 100 and passing now enter the value for the position one 200 enter the value
for position two 200 enter the value for position three 400 enter the value for position four 500
okay so it will be more meaningful so now we are able to store data in Array and also we are able
to read data from array so dynamically we can pass data into array by simply writing one for Loop
statement okay so these are the some examples you guys can practice each and every example and which
is most important you will be asking so many type of questions from aray concept especially there
are so many programs you have to practice still more because it is not possible to discuss each
and every program 500 programs you can practice based on this concept some of them I will give you
assignment but after completion of java sessions I will also give you some list of programs and
uh you can refer them so this is all about Aras concept and two dimensional is not that much
important you can just try to understand how to read data and how to write data into the two
Dimension array that is more than enough for now and please concentrate more on single dimensional
and different type of operations okay now based on this I will give you some assignments you
guys can try this example five we already taken reading data into array by using scanner
class we will able to achieve this okay now assignments So based upon today's topic only I'm just giving this assignments
and you can try this only two assignments and tomorrow I will discuss about
strings concept and then I will also give some more assignments related to string okay first
uh sorting elements using looping we have seen sorting by using build-in methods Aras do sort
method okay and there are so many methods are there as I already told you there are different
type of algorithms are there and uh you guys can go through these two videos and try to understand
but not mandatory now in future you can try this okay and uh second assignment find missing
number in Array this is the most popular example find missing number in Array suppose in
Array I provided some data like this 1 14 52 or 1 1453 right which number is missing in this which
number is missing 1453 there is one number is missing in this two is missing okay that we need
to find out but what is the prerequisite numbers should be in range numbers should be in the range
what order is not important it is started from one two is missing but three is there four is
there five is there so one to five is a range actually and only two is missing so the first
prerequisite is what numbers should be in range when you create some data you have to provide the
numbers in particular range and should not have a duplicates that's another prerequisite okay this
should not have a duplicates so you can easily find the missing number there is small logic is
there so if you apply that logic you can easily find out so try to do this I I'm providing this
reference very interesting example also if you look at this video if you watch the video you
will understand very easy and very interesting also I can just find this reference video and
you guys understand you can try yourself find missing number in in area okay and similarly
there are some more programs are there find largest number in Array and similarly find lowest
number in ARR largest number and lowest number I will provide the links later here and you guys
can try this find the largest number in a find the lowest number in a so these are the four
assignments you guys can try and I will provide the links to these also and after providing the
links I will upload okay fine so this is all about array concept and tomorrow session we will
discuss about strings which is also most important popular topic and aray concept still continues
so many places many cases we use this arrays concept so you will understand so many examples
also in the coming sessions this is just uh the beginning okay so in the coming session you will
try to use these Concepts in many places in many scenarios even in automation also we will
use this concept in many use cases so very important topic you can't skip it every example
you have to practice till you familiar with this concept okay so that's all for today's session
I'll stop here and we will continue tomorrow
Get free YouTube transcripts with timestamps, translation, and download options.
Transcript content is sourced from YouTube's auto-generated captions or AI transcription. All video content belongs to the original creators. Terms of Service · DMCA Contact