Top Banner

of 10

C&DS Unit-II

Apr 09, 2018

Download

Documents

N. Janaki Ram
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/7/2019 C&DS Unit-II

    1/10

  • 8/7/2019 C&DS Unit-II

    2/10

  • 8/7/2019 C&DS Unit-II

    3/10

  • 8/7/2019 C&DS Unit-II

    4/10

  • 8/7/2019 C&DS Unit-II

    5/10

  • 8/7/2019 C&DS Unit-II

    6/10

  • 8/7/2019 C&DS Unit-II

    7/10

  • 8/7/2019 C&DS Unit-II

    8/10

    C & DS for I MCA Unit-2 VVIT

    Staff: Janaki Ram and Krishna Prasad Dept of IT and CSE Page:8

    Symbolic representation follows:

    iinntt aa[[33]][[44]] == {{ 1111,, 5555,, 4444,, 3333,, 7777,, 9999,, 8888,, 6677,, 2222,, 2255,, 7788,, 8877}};;

    1111 5555 4444 3333

    7777 9999 8888 6677

    2222 2255 7788 8877

    HHeerree

    aa[[00]][[00]] == 1111 ,, aa[[00]][[11]] == 5555,, aa[[00]][[22]] == 4444,, aa[[00]][[33]] == 3333

    aa[[11]][[00]] == 7777,, aa[[11]][[11]] == 9999 ....

    aa[[22]][[00]] == 2222,, aa[[22]][[11]] == 2255

    Advantages of Arrays:

    11.. AArrrraayyss ccaann hhoolldd aa ccoolllleeccttiioonn ooffiiddeennttiiccaall vvaalluueess..22.. AAcccceessssiinngg ooff aarrrraayy eelleemmeennttss iiss eeaassyy ((ssiinnccee tthheeyy aarree ssttoorreedd iinn ccoonnttiinnuuoouuss mmeemmoorryy

    llooccaattiioonnss))..

    33.. PPooiinntteerrccaann bbee aapppplliieedd oonn aarrrraayyss..44.. MMoorree fflleexxiibbllee..

    Disadvantages of arrays:

    11.. AAss tthhee aarrrraayy ssiizzee iiss ffiixxeedd,, wwee ccaannnnoott iinnccrreeaassee oorrsshhrriinnkktthhee ssiizzee.. HHeennccee iitt mmaayy lleeaadd ttoowwaassttaaggee ooffmmeemmoorryy..

    22.. IInnsseerrttiioonnss && ddeelleettiioonnss aarree ddiiffffiiccuulltt ttoo ppeerrffoorrmm..33.. UUnnaabbllee ttoo hhoolldd ddiiffffeerreenntt kkiinnddss vvaalluueess..

    Note:: IIff tthhee ddiimmeennssiioonn ooff aann aarrrraayy iiss iinnccrreeaasseedd bbeeyyoonndd 22 tthheenn iitt iiss ccaalllleedd MMuullttii--DDiimmeennssiioonnaall

    aarrrraayy.. IInn ggeenneerraall,, mmoorree tthhaann 33DD--aarrrraayyss aarree nnoott uusseedd..

    Strings:

    AA ssttrriinngg iiss aa ccoolllleeccttiioonn ooffcchhaarraacctteerrddaattaa.. IInn ootthheerrwwoorrddss,, aa sseett ooffcchhaarraacctteerrss ffoolllloowweedd bbyy aannuullll iiss kknnoowwnn ttoo bbee aa ssttrriinngg ii..ee..,, aatt tthhee eenndd ooffeevveerryy ssttrriinngg,, tthheerree eexxiissttss aa nnuullll tteerrmmiinnaattiinnggcchhaarraacctteerr((\\00)).. IItt rreepprreesseennttss eenndd ooffssttrriinngg.. SSttrriinnggss ccaann hhoolldd wwoorrddss oorrsseenntteenncceess..

    IInn CC ssttrriinnggss aarree rreepprreesseenntteedd uussiinngg aa cchhaarraacctteerraarrrraayy.. SSttrriinngg ccoonnssttaannttss aarree ppllaacceedd bbeettwweeeenn 22ddoouubbllee qquuoottaattiioonnss..

    0

    1

    2

    0 1 2 3

  • 8/7/2019 C&DS Unit-II

    9/10

  • 8/7/2019 C&DS Unit-II

    10/10