Friday, October 7, 2011

ITE221 - Fall 2011 - Chapter 3


The site I looked at in connection with Chapter 3 in my text was Part 1 of “An Extensive Examination of Data Structures”, as applied to Microsoft’s .NET Framework, and was hosted on Microsoft’s MSDN Library page. Part 1 (of 6) is the Introduction to the full article (including a look at what topics will be covered in the other sections), takes a look at efficiency of data structures and why that’s important, and examines the Array and ArrayList structures, which are the most common structures used in .NET. The author points out why efficiency is important in consideration of data structures – they’ll need to be searched, and search time will determine performance of the overall program, so if you can use a data structure which can be searched faster, the user will be more satisfied with the program’s performance. He goes on to give information about arrays – they are the simplest, most-widely used data structures in .NET. The contents of an array are stored in contiguous memory, and must all be of the same type (arrays are homogenous structures); arrays can be accessed directly, without going through each element of the array, if you know what location the desired element is stored at. He goes on to lay out some code for an example of array construction, and points out that in order to redimension an array (change it’s size), a new array must be created which copies the old one’s data into itself and has the desired extra room.
            Next, the author introduces ArrayLists, and explains why one might wish to use them instead of arrays. Where arrays are homogenous and must have a specifically-allocated amount of space (a specified number of elements), arraylists may have multiple data types through the use of objects containing potentially-different data types and the number of elements in an arraylist need not be specified (although they can be, if the programmer wishes) – an arraylist automatically is created with 16 spaces for data elements, and if an addition would exceed the space available for elements, the arraylist is automatically redimensioned to double its size. This can make it more convenient to use, but comes at the cost of performance, since more actions take place when reading or writing to the arraylist. The self-redimensioning, on the other hand, should not cause a performance hit compared to an array, according to the author.
            Overall, this seems like a fairly trustworthy look at data structures used in Microsoft .NET – the author is not trying to sell anything, and seems to be a sufficiently-authoritative source. This and the follow-on sections appear to be a good source for information.

No comments:

Post a Comment