DOC PREVIEW
DREXEL CS 265 - Growing_Arrays_in_C_rs

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Growing Arrays in CArraysWhat are Growing Arrays?Comparisons to C++/JavaStructWhy Grow Arrays?Why not use Growing Arrays?Benefits of Growing ArraysDrawbacks of Growing ArraysDeleting a NameQuestions???Robert ShieldsArraysAn array is basically a variable that contains a listArrays are one of the simplest data structures in CThey have many uses and a broad range of tools associated with themWhat are Growing Arrays?Growing Arrays are arrays that are constantly having new sorted values added to themThey are used in situations where we need to keep track of a variableOften overshadowed by hash tables due to the amount of resources needed for large arraysComparisons to C++/JavaIn C++ or Java, Growing Arrays would be replaced by classes from standard librariesIn C, these Growing Arrays are constructed using a structstruct { char cname[8]; char sname[16];char exam[16]; char grade; } record;StructA struct is used to declare a new data typeThis basically means grouping variables togetherSimilar to enum in C++Why Grow Arrays?Growing arrays is usually a resource hungry operationUsed when elements added (n) is relatively smallVery convenient data structureFixed size data sets, arrays idealWhy not use Growing Arrays?Changing set of values in arrays can be expensiveNumber of elements unpredictableNumber of elements potentially largenBenefits of Growing ArraysArrays are simplest way to group dataMost languages have efficient and convenient tools for arraysArrays work well with sorting algorithmsProvide easy access to any itemDrawbacks of Growing ArraysCannot handle large amounts of data changeRequires resorting of entire array upon deletion of elementsElements can sometimes be overwritten by fast “squeezing” algorithmsMust decide on correctness or speedDeleting a NameDeleting a name in an array is trickyDeleting the name results in a gap in the arrayEasiest solution is to swap last element into the gapMore complicated if order


View Full Document

DREXEL CS 265 - Growing_Arrays_in_C_rs

Download Growing_Arrays_in_C_rs
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Growing_Arrays_in_C_rs and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Growing_Arrays_in_C_rs 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?