The Most Commonly-used Data Structures

Slides:



Advertisements
Similar presentations
David Luebke 1 6/7/2014 CS 332: Algorithms Skip Lists Introduction to Hashing.
Advertisements

Computer Science 112 Fundamentals of Programming II Overview of Collections.
Data Structures Simple data type –int, char, long Reference data type –Integer, String, Composite data type == Data Structure –Collection of elements.
1 abstract containers hierarchical (1 to many) graph (many to many) first ith last sequence/linear (1 to 1) set.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Tools for Text Review. Algorithms The heart of computer science Definition: A finite sequence of instructions with the properties that –Each instruction.
CS 171: Introduction to Computer Science II
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Review for Test 2 i206 Fall 2010 John Chuang. 2 Topics  Operating System and Memory Hierarchy  Algorithm analysis and Big-O Notation  Data structures.
Data Structures & Java Collections Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
COMP 171 Data Structures and Algorithms Tutorial 10 Hash Tables.
1 abstract containers hierarchical (1 to many) graph (many to many) first ith last sequence/linear (1 to 1) set.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
The Design and Analysis of Algorithms
Important Problem Types and Fundamental Data Structures
Maps A map is an object that maps keys to values Each key can map to at most one value, and a map cannot contain duplicate keys KeyValue Map Examples Dictionaries:
Graphs and Sets Dr. Andrew Wallace PhD BEng(hons) EurIng
Trees & Graphs Nell Dale & John Lewis (adaptation by Michael Goldwasser and Erin Chambers)
Copyright © Wondershare Software Introduction to Data Structures Prepared by: Eng. Ahmed & Mohamed Taha.
Comp 249 Programming Methodology Chapter 15 Linked Data Structure - Part B Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
A Level Computer Science Topic 9: Data Structures T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen.
Data Structures Winter What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important.
Introduction to Data Structures. Definition Data structure is representation of the logical relationship existing between individual elements of data.
COMP 103 Introduction to Trees.
Lecture 10: Class Review Dr John Levine Algorithms and Complexity March 13th 2006.
Introduction to Data Structures Fall 2008 Dr. David A. Gaitros
ECE 103 Engineering Programming Chapter 61 Abstract Data Types Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Chapter 6 Binary Trees. 6.1 Trees, Binary Trees, and Binary Search Trees Linked lists usually are more flexible than arrays, but it is difficult to use.
Chapter 9 Abstract Data Types and Algorithms Nell Dale John Lewis.
Review for Final Andy Wang Data Structures, Algorithms, and Generic Programming.
9-1 Abstract Data Types Abstract data type A data type whose properties (data and operations) are specified independently of any particular implementation.
Data structures Abstract data types Java classes for Data structures and ADTs.
Overview of Course Java Review 1. This Course Covers, using Java Abstract data types Design, what you want them to do (OOD) Techniques, used in implementation.
Chapter 8 Data Abstractions. © 2005 Pearson Addison-Wesley. All rights reserved 8-2 Chapter 8: Data Abstractions 8.1 Data Structure Fundamentals 8.2 Implementing.
1 Searching Searching in a sorted linked list takes linear time in the worst and average case. Searching in a sorted array takes logarithmic time in the.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
12/8/2015CS Introduction to Information Engineering1 Data Structure 12/8/2015 Che-Rung Lee.
Data Structures academy.zariba.com 1. Lecture Content 1.Linear Data Structures 2.Trees and Graphs* 3.Dictionaries and Hash Tables 4.Homework 2.
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
Chapter 16 – Data Structures and Recursion. Data Structures u Built-in –Array –struct u User developed –linked list –stack –queue –tree Lesson 16.1.
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
Data Structures for Midterm 2. C++ Data Structure Runtimes.
Discrete Mathematics Chapter 5 Trees.
CSS446 Spring 2014 Nan Wang.  to study trees and binary trees  to understand how binary search trees can implement sets  to learn how red-black trees.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
CHAPTER 9 HASH TABLES, MAPS, AND SKIP LISTS ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++,
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
Data Structures What The Course Is About Data structures is concerned with the representation and manipulation of data.
Data Structure and Algorithms
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
Chapter 9 Abstract Data Types and Algorithms Nell Dale John Lewis.
CSC 143T 1 CSC 143 Highlights of Tables and Hashing [Chapter 11 p (Tables)] [Chapter 12 p (Hashing)]
DATA STRUCURES II CSC QUIZ 1. What is Data Structure ? 2. Mention the classifications of data structure giving example of each. 3. Briefly explain.
CPS120: Introduction to Computer Science Nell Dale John Lewis Abstract Data Types.
Introduction toData structures and Algorithms
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
Fundamentals of Programming II Overview of Collections
The Design and Analysis of Algorithms
COMP 53 – Week Eleven Hashtables.
Basic Data Structures.
Data Structures Data Structure is a way of collecting and organising data in such a way that we can perform operations on these data in an effective.
Hashing Exercises.
Chapter 8: Data Abstractions
abstract containers sequence/linear (1 to 1) hierarchical (1 to many)
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Important Problem Types and Fundamental Data Structures
OPIM 915 Fall 2010 Data Structures 23-38,
Presentation transcript:

The Most Commonly-used Data Structures Terence Parr USF

Introduction Abstract data types Data structures (implementations) Combinations

Abstract Data Types List Set (unordered, unique) stack, queue, prioritized queue, … Set (unordered, unique) Dictionary (also called Map) Graph (directed or undirected) Tree Binary tree Choose via: access pattern, properties, element relationships Implementations chosen to optimize time/space

List Operations: add, get, insert, delete, find queue: add to tail, get only from head stack: add to “top”, delete from “top” Typical implementation: array or linked list Examples: list of users, list of books

Set Operations: add, delete, contains Typical implementation: bit vector (if elements are integers) or hash table Examples: set of universities, set of students

Dictionary Operations: map x->y, get x, delete x Typical implementation: hash table Examples: student -> userid student -> list of classes

Graph Collection of nodes connected by directed or undirected edges with or without labels Path==sequence of edges Operations: add node, add edge x->y, delete node, delete edge Typical implementation: node has list of edges that point to other nodes Examples: network simulation, email trail between employees (social network), finite automata

Tree A kind of directed graph with unique edge path from node x to y Children: emanating edges, Root: topmost node, Leaves: nodes w/o children Operations: add child, delete a child Typical implementation: node has list of children (again, a restricted graph) Examples: organization chart, class hierarchy, expression tree Binary tree: at most 2 children per node

Implementations

Linked list head, tail pointers wrapper to hold value and “next” Operations: get O(1) others O(n)

Hash table Fast implementation of a dictionary; like an associative memory; maps key to value Idea: break up large search space into many smaller spaces “hash function” tells you which of the smaller spaces (“buckets”) has element of interest search linearly within smaller space simple hash of int: hash(x)=x; hash of string: sum of char values Array of lists; each list is a bucket of key/value pairs bucket index(key) = hash(key) % num_buckets

Hash table 2

Tree Node has list of children; need root ptr CEO + 3 * President 4 5 VP Sales VP Eng.

Graph States or nodes have list of edges to other states Mary Jim Chris Tim Jen