Crash Course – Basic Data Structures
Primitive Data Types
-boolean
-byte
-char
-int etc
Array
-just a number of items, of same type, stored in linear order, one after another.
-have a set limit on their size, they can’t grow beyond that limit.
-If you have an array of 100 max elements, it will not be able to store 101 elements.
-if you have less elements, then the unused space is being wasted (doing nothing).
Array Lists
-implemented using arrays
-allow for the insertion and removal of objects from both ends
-A list is kind of a stack combined with a queuewith additional feature of looking at the middle elements.
Vector
-implement an array for their storage. (array based data storage classes)
-can grow, shrink, and do some quite useful things.
-reallocating a new array every time you want to do some of these operations, and later copying the old array into the new array.
-It can be quite fast for small sizes, but when you’re talking about several megabyte arrays, and every time you’d like to add one more number (or object) you might need to reallocate the entire array; that can get quite slow.
Linked Lists
-a chain of nodes, with each subsequent node being a child of the previous one.
-don’t have any evident restrictions.
-[node0]->[node1]->[node2]->[node3]->[node4]->null
-does not use array internally
Trees
-node based data structures
-Tree Nodes have two or more child nodes; unlike our list node, which only had one child.
About this entry
You’re currently reading “Crash Course – Basic Data Structures,” an entry on /kapil/blog
- Published:
- 4.27.07 / 8am
- Category:
- Uncategorized
- Tags:
- basics, datastructures
No comments
Jump to comment form | comments rss [?] | trackback uri [?]