Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
11 views

DSA Lab Assignment- 1

Uploaded by

Omkar Kumbhar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

DSA Lab Assignment- 1

Uploaded by

Omkar Kumbhar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Date

Practial Assinomert -l (Pngo No

Title Aray CLS ao AD

* Objectives
1.To 9desstaro Ara Dada type.
Q.Uhclerstand the appition of ttray as gpa(se
madiot:o
*Prablem.Sttement i
aA'- Implenext cpplicoion of arrany in spacse
matriedo perosm gimple &fasttsorspase.
oomesi
oF Complcn o! tis assignment
assignme hudeat
cwill eable o
easn 4 h e D esSa
Lecrn the applicadion Oo! CISayas SpacSe

*Softose &Hasdwase sequíements i


Setwase Dbanta Cas aperading Sstem),
Lcipgo TDE
Haclesace'-pessop
Theciky Crhcegt
and kegbantcl
An alsay is acteeet collecdion otemg.
Sam Variable typethed ase
STosecat Contiuoue memor locationg
One ephe
ep most papttas & sionple
Dado otctuses_ and is oten used to
implement otherclada strucluces"fach item
mynotee
Vy Kncwledge bank
Date:
Page No 2

Qn is incleKe) stoutig th O.
Lach elemet in is abcessel
thxough istuoindlea
chm ensionalariny
the simples) ocm a the
muioimention A/e Convisucize
C two - dìm pnsiona one-dimeatiar
arays stacked Verleal facming
tble th KowS
Cndoloun s.
lo Caecte a 2D array of int egerke
he falloing exongle

The cineosion sepresents the number


xepresent
The
the Dumber oof Col umng[T
Values ase placeol
andCan be vis ucizeo ike ti

Roc Calumn
ROw
Ro w 9
6

What is Spcuse Modbie ?


A
A motic a tuo-cimensional cado
objec made rows and columns +

Resere havingtota! mxn YalerIf. mos


e the eemend sg the marin hare OVale
mynotaa
ly Knowiodgs bank
Chate

Page No

then it Called matie


Cparse Matic

*Conclasion ne Jeaca to implersand arny


Spasse
euchoct:Stort.
nqin merthe))

Titiaize Matsid

Tensse Star
Deine 20 athir Dctetmind Matsie prntMatsie

psint
Teerate te
Crigina matoie pint
nati Vahee
Assingn the Grgs
Jpordi e kmerd fen!
origina) otrenspose.
Psiot
origino
matié
Pist Tronspose ralJ

mynotes
y Knouedoe ten
DA Lab -1

Prachical
QolProb lernstotemests Assigpment - Pege No

A Implement
matrie to applicadiod ofof
perform simple
Aray spatoe.
ane
(Fast transpose) transpase
Toplemen Application o ar in polynomial
etpreSsion
Salian'
A.Tmatrice
apleomend toapplication
perfocrm
of Acroyspase.
CFast Tons pose) Simpleand trons pase
Publie clas
impleTranspase
public static Voicl main (sting II
iot CJCJ matrie
=L,24,3, 43
int sosS = matrin .lengthi
int cols = matris LoT. Jength
int IJCI transpasedmatrik =new intCcols Itoua
osCint i:0; isfows;i)
fes Cintj=oi j<cols j+)
tsansposed iatrie LiJCJ:matrir C:I]i
3
Systern. out. println "Origin a Matrim:";
print atrir Cnadria);
mynctes
My Knowiedge tank
Dats: I
Page No

Systen.aud println"eei Transposed Matsi);


print)Motik (tsansposeolXModeisi
public Static oicl prind Matciee CintcJCI
mcdria)
for Cin CJ sowi
medei)
fon Malue iraw)
System acut-print (uaae"");O
System.od printaO;

Outputi
Origincl matric
2

5 6
TTaasposed
3 5
matie:
2

mynotes
Activities O Terminal
mca01cOmca01-1neentre-n

nca01@mca01 -ThinkCentre-neo-50t -Gen3:


javac sLnplerranspose.java
nca0iGmca01 -ThinkCentre-neo-50t-Gen-3:
java SLnpletranspose
Original Matyrix:
12
3 4
56
Transpose Matyrix:
1 3 5
24 6
-3:eletop?ONarsYNO $
nca01@mca 01-ThinkCentre - neo-50t - Gen

Comglek

ulidl24
TiHle: Acsasy. Oao AADT'
Psoblem stetemend:
2 Impleet appicedion ef
palynomial etpresson.

Olbjecives:
To undes stcund cror Dote yee
he
io polynemi) ecpresSion
Outcame?
(ormpleliopo he
Sdudet loe aBleto
-) Leoo the rra
-) eocn he Cuflicedion o cray
polynonmial epaesgion.
Sofwose & Horcdcce eguisemerts:
SeiwcYe & dcsclure 1equiements
Sofiwore'- Obntu(as gperang System) loipse TDE
thrccre'- DeskBep & keyboascl.
Thec onoept'
A polynormia) is modhemcdiço
expressiontha CastainnOre then 2
-algoxithmie algebrjeermms. I+ is asup
3everal tesmAhat Cotain cliferent
pcwet Cf the Some Varible.
1iS necesSas fos tie polmomial
ecpression. Corsisls f two pests
mynctes
Kooeiedgs bene
Date:

Page No. lo

oeficce puct 2. Etponpnt act


Ecample -
4x^2t_3^+2o^o, Here tho 43, 2
are the Coeficieds R d,rO ase the
eotponertia) values.

Conclusion'
Hesoe)e lecsn the Tmplem erdatien

mynota
8) Inpkment Appliced ien of Array in Ate poynaminl
eopressioo
Sol class poy9omio
private _int II co efficents;
public polynomia Cint clegree)
Coefficients sneu int Leleg1ee +L

public oi ol setCoefficient nt degree,


int Coe fficient)
Coefficients Ldegsee]= Coefficienti.
publiéint
int getoefficient Cint degree
retusp coeFficiend s Cdeareli

puslic polynomnal iacld (Polyng miol other)


Coefficien
Int omxDegree = Math.mar this.
-tshergth)j
polynomicl resut E nec) Polynorial(nax
Degree -i);
For Cint i=o1<mar Degreeiit#)
int this off =i< this. CoePFicents. lenqth
2this- cocffi ciends Ci]:6;
mynotes
My Knoiodge ten
Dato
Page No

int other Coe FEi<other. (oefficients length ?


other. Coefficierts Iiio;
result .set (oePficient (isthis Caefftather
CoCfE);

return reslt

Public in ealucte Gnd x)


intsesult =0j
fosCin? i= caefficiends Jength -I;i2r0; i)
Tesult resu! x 4 coe fficients L
setunresult;
public Moic print )
for( int ie (aefficients. lenatA -I;i) =0;

Systemout psind Coefficients ilt

3 Syotem out.psind C"t


mynotss
My Knowludga bank
Page No L3

System.out.poiornC);

public static Voio! main Stingcargs )


Pobnormia pl ne) Polynomial (D).
PsetCoe Tficiet o)i
I setoeTEicientC,3);
plsedcoefficient (2.4);
p2. set Ge£ficient (o, ;
p2 setoefficientCl, 22;
PRsetocFFicent (R13;
Systerm ot priatln C'Polyoorsicd 1: "
plprint COj
System.qud. println ("polnomial 2:")
-pi prinic
Polynomid Sum = pl ado (P2),;
System.oud. pointn ("sum of Polynomials");
Sum- pr int';

System. out pritn "Eaha ~ion of palynamia!


1_at

IRmynctes
Ne ENceiedog hane
Date

Page No

Qutput:
Polynonmicl :
Poynemial 2:
Sum of polynomiclsi
Evadation GP Polynornia! Lat x 2:24

mynotes
My Kngwiedgs bank
01:38
Sep
30
java
.Polynomial
Polynonial
java
javac
SS
: -3:
ThinkCentre
-neo-50t-Gen-3 neo-50t-Gen-3:
2:24
ThinkCentre-neo-50t-Gen
=
x
at
1
Polynomial
-
-ThinkCentre
Polynomials:
Sum
of 3x^O
2x^O1x^O
O
Terminal + 2: + + of
- 1:
Polynomial
mcaiGmca01
- nca01amca01
3x^1 2x^1 5x^1
Polynomial nca01Gmca01
Evaluation
+ + +
4x^2 3x^2 7x^2
Activities
A ?

You might also like