Download C# GENERICS - Western Washington University

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Entity–attribute–value model wikipedia , lookup

Big data wikipedia , lookup

Data Protection Act, 2012 wikipedia , lookup

Data center wikipedia , lookup

Data model wikipedia , lookup

Linked list wikipedia , lookup

Forecasting wikipedia , lookup

Data analysis wikipedia , lookup

Database model wikipedia , lookup

3D optical data storage wikipedia , lookup

Information privacy law wikipedia , lookup

Data vault modeling wikipedia , lookup

Business intelligence wikipedia , lookup

Transcript
DATA STRUCTURES
& C# GENERICS
Trent Spangler | Greg Phelps
OUTLINE
Data Structures
C# Generics
•
•
•
•
•
• Definition
• Pros & Cons
• In Depth
Importance
Definition
Examples
Different Structure Types
Uses
Why are data structures important?
• Store and manage large amounts of data efficiently
• Databases
• Sorting or Indexing Services.
• Search structures for information we want
DATA
STRUCTURES
“A particular way of storing
and organizing data.”
Real-world
Examples
Structure Types
Array
Linked List
Sorted List
Trees
Hash Table
Queues & Stacks
Arrays
“systematic arrangement
of objects, usually in
rows and columns”
1, 2, and 3 Dimensional
Linked List
• Data stored in a “node” which means it contains data and
a reference to the next node in the sequence
• Advantage:
• Easy insertion or deletion without reorganization
• Disadvantage:
• Must search from the beginning because lists are sequential/ordered
Sorted List
Similar to Linked List
“Nodes” are sorted and are
inserted accordingly
Trees
Each “node” has no more
than two children, referred to
as left and right.
Example
Hash Table
Value = phone #
Key = Sandvig
Hash(Sandvig)  5
Hash(Gandalf)  5
Queues & Stacks
Push: insert
Pop: extract
Peek: examine
STACTIVITY
GENERICS
What are they?
A simple
definition:
“Generics allow you
to define type-safe
data structures,
without committing
to actual data types.”
Generics
Pros & Cons
Mainly used with
collections/data structures
• Pros
• Code Reusability
• Type Safety
• Increased performance from less code
• Cons
• Complexity
• Learning curve
Generics In Depth
• Information is stored in
objects instead of variables
• Note: You cannot implicitly
convert type object to other
data types (int, string, etc.)
Dracula
Explanation
of
Generics
REFERENCES
• http://en.wikipedia.org/wiki/Data_structure
• http://en.wikipedia.org/wiki/Main_Page
• http://codersbarn.com/post/2008/04/09/What-are-CGenerics-Part-I.aspx