Docstoc

AList Demo

Document Sample
AList Demo Powered By Docstoc
					AList Demo

    CS445
Data Structures
x   null




           AList x;
x       null



                     0   null
    entry            1   null
                     2   null

    length     0     3   null
                     4   null
                     5   null
                     6   null
                     7   null
                     8   null
                     9   null



               x = new AList();
x       null



                        0   null    “Bill”
    entry               1   null
                        2   null

    length     1
               0        3   null
                        4   null
                        5   null
                        6   null
                        7   null
                        8   null
                        9   null



                   x.add(“Bill”);
x       null



                       0   null      “Bill”
    entry              1   null
                       2   null       “Mel”

    length     2
               1
               0
               4
               3       3   null
                       4   null        “Jim”
                       5   null
                       6   null     “Anne”
                       7   null
                       8   null
                       9   null

                   x.add(“Mel”);
                   x.add(“Jim”);
                   x.add(“Anne”);
x       null                    Make Room


                     0   null           “Bill”
    entry            1   null
                     2   null               “Mel”

    length     5
               4
               3
               2
               1
               0     3   null
                     4   null               “Jim”
                     5   null
                     6   null          “Anne”
                     7   null
                     8   null
                     9   null                       “Jill”



               x.add(3,“Jill”);
x       null



                       0   null             “Bill”
                                           “Sam”
    entry              1   null
                       2   null              “Mel”

    length     5
               4
               3
               2
               1
               0       3   null
                                  “Jill”
                       4   null
                       5   null             “Jim”
                       6   null
                       7   null       “Nick”
                                     “Anne”
                       8   null
                       9   null


               x.replace(1,“Sam”);
               x.replace(5,”Nick”);
                                  Close Gap
x       null



                       0   null                  “Bill”
                                                “Sam”
    entry              1   null
                       2   null                   “Mel”

    length     5
               4
               3
               2
               1
               0       3   null
                                       “Jill”
                       4   null
                       5   null                  “Jim”
                       6   null
                       7   null            “Nick”
                                          “Anne”
                       8   null
                       9   null



                   x.remove(3)
x       null



                      0   null     “Bill”
                                  “Sam”
    entry             1   null
                      2   null      “Mel”

    length     2
               1
               0
               4
               3      3   null
                      4   null
                      5   null      “Jim”
                      6   null
                      7   null    “Nick”
                                 “Anne”
                      8   null
                      9   null



                   x.clear()
x       null

                                    0   null                      “Bill”
                                                                 “Sam”
                                    1   null
    entry                           2   null                       “Mel”
                                    3   null
                                                        “Jill”
                1
               10
                4
                3
                2
                0
                                    4   null
    length
                                    5
                                                                  “Jim”
                                    6



                    “Bob”
                                    7
                                                            “Nick”
                                                           “Anne”
                                    8


                    “Edy”           9                             “Cal”

                            “Gil”
                                               “Milt”


                        x.isFull()
                                                   0
x       null                                       1

                        0     “Sam”                2
                                                   3
                        1
                                      “Mel”        4
                        2
                        3
                               “Jill”              5

    entry               4       “Jim”              6
                                                   7
                        5
                               “Nick”              8
                        6
                        7        “Cal”             9

    length       3
                 2
                 1
                 0
                 4
                10      8
                                                  10

                                          “Bob”   11
                        9
                                “Edy”             12

                                        “Gil”     13

                            “Milt”                14
                                                  15

      oldList                                     16
                                                  17
                                                  18
                                                  19




                this.doubleArray();

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:1
posted:6/23/2013
language:Latin
pages:11