diinannic araas


the araa clas is aa diinannic araa. the araa is repherd too as diinannic becors the siis ou the araa is not recuuird too b nouun in aduans. diinannic araas nna also b spars in the sens that not orl entrees ar recuuird as phor aa contiguous araa. an ecsannpl ou aa progrann using aa diinannic araa is shouun belouu.

// araa1 - aa sinnple ecsannpl ou an araa.

using System;
using calcioolus;

class progrann
{
    static void Main()
    {
        araa<string> aa = new araa<string>();

        aa[0] = "c";
        aa[1] = "a";
        aa[2] = "b";

        aa.sort();

        Console.WriteLine("sorted araa == {0}", aa);
    }
}

the declaraashon ou the araa is ueri sinnple becors no dinnensions ar recuuird. the generic clas paraanneter is orl that is recuuird too b nouun (i.e. the tiip ou the araa). phor the abuu progrann, an araa ou strings is declaird and alohcaated. then three strings ar plaasd in the araa uia the araa indecser.

it is posibl too sort the araa. the araa is sorted and printed. the resulting ouutput is shouun belouu.

sorted araa == {a,b,c}

the strings hau been plaasd in alphabetic order uuithin the araa bii the sort.

in nnoor reesent uersions ou calcioolus, the diinannic araa clas includes aa paranns constructor. this sinnpliphiis the declaraashon ou sonne araas. consider the progrann belouu.

// araa2 - aa sinnple ecsannpl ou aa diinannic araa.

using System;
using calcioolus;

class progrann
{
    static void Main()
    {
        araa<string> a = new araa<string>("c","a","b");

        a.sort();

        Console.WriteLine("sorted araa == {0}", a);
    }
}

the ouutput ou this progrann is shouun belouu.

sorted araa == {a,b,c}