data structures & c # generics

18
DATA STRUCTURES & C# GENERICS Trent Spangler | Greg Phelps

Upload: rhonda

Post on 19-Feb-2016

47 views

Category:

Documents


3 download

DESCRIPTION

DATA STRUCTURES & C # GENERICS . Trent Spangler | Greg Phelps. OUTLINE. Data Structures Importance Definition Examples Different Structure Types Uses. C# Generics Definition Pros & Cons In Depth . Why are data structures important?. Store and manage large amounts of data efficiently - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: DATA STRUCTURES  & C # GENERICS

DATA STRUCTURES & C# GENERICS

Trent Spangler | Greg Phelps

Page 2: DATA STRUCTURES  & C # GENERICS

OUTLINEData Structures• Importance• Definition• Examples• Different Structure Types• Uses

C# Generics• Definition• Pros & Cons• In Depth

Page 3: DATA STRUCTURES  & C # GENERICS

Why are data structures important?

• Store and manage large amounts of data efficiently• Databases• Sorting or Indexing Services.

• Search structures for information we want

Page 4: DATA STRUCTURES  & C # GENERICS

DATA STRUCTURES

“A particular way of storing and

organizing data.”

Page 5: DATA STRUCTURES  & C # GENERICS

Real-world Examples

Page 6: DATA STRUCTURES  & C # GENERICS

Structure Types

ArrayLinked ListSorted List

TreesHash Table

Queues & Stacks

Page 7: DATA STRUCTURES  & C # GENERICS

Arrays“systematic

arrangement of objects, usually in rows and

columns”

1, 2, and 3 Dimensional

Page 8: DATA STRUCTURES  & C # GENERICS

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

Page 9: DATA STRUCTURES  & C # GENERICS

Sorted ListSimilar to Linked List“Nodes” are sorted and are inserted accordingly

Page 11: DATA STRUCTURES  & C # GENERICS

Hash Table

Value = phone #Key = SandvigHash(Sandvig) 5Hash(Gandalf) 5

Page 12: DATA STRUCTURES  & C # GENERICS

Queues & Stacks

Push: insertPop: extractPeek: examine

Page 13: DATA STRUCTURES  & C # GENERICS

STACTIVITY

Page 14: DATA STRUCTURES  & C # GENERICS

GENERICSWhat are they?

Page 15: DATA STRUCTURES  & C # GENERICS

A simple definition:

“Generics allow you to define type-

safe data structures, without

committing to actual data types.”

Page 16: DATA STRUCTURES  & C # GENERICS

GenericsPros & Cons

• Pros• Code Reusability• Type Safety• Increased performance from

less code

• Cons• Complexity• Learning curve

Mainly used with collections/data

structures

Page 17: DATA STRUCTURES  & C # GENERICS

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.)

DraculaExplanation

ofGenerics