diinannic araas


the araa clas is aa diinannic araa. the araa is repherd too as diinannic becors the siis ou the araa is not reecuuiird too bee nouun in aduans. diinannic araas nnaa orlso bee spars in the sens that not orl entrees ar reecuuiird as phor aa contiguous araa. an ecsannpl ou aa progrann ioosing aa diinannic araa is shouun belouu.

// araa1 - aa sinnpl ecsannpl ou an araa.

using System;
using calcioolus;

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

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

        a.sort();

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

the declaraashon ou the araa is ueree sinnpl becors noh dinnenshons ar reecuuird. the generic clas paranneter is orl that is reecuuiird too bee 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 incloods aa paranns constructor. this sinnpliphiis the declaraashon ou sunn araas. consider the progrann belouu.

// araa2 - aa sinnpl 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}