A Data Structure Bestiary

Slides:



Advertisements
Similar presentations
Transparency No. 1 Java Collection API : Built-in Data Structures for Java.
Advertisements

Stacks, Queues, and Linked Lists
Computer Science 112 Fundamentals of Programming II Overview of Collections.
Chapter 6 The Collections API. Simple Container/ Iterator Simple Container Shape [] v = new Shape[10]; Simple Iterator For( int i=0 ; i< v.length ; i++)
CS Data Structures II Review COSC 2006 April 14, 2017
COMP 103 Linked Stack and Linked Queue.
Priority Queues. 2 Priority queue A stack is first in, last out A queue is first in, first out A priority queue is least-first-out The “smallest” element.
CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
Fall 2007CS 2251 Iterators and Tree Traversals. Fall 2007CS 2252 Binary Trees In a binary tree, each node has at most two subtrees A set of nodes T is.
Priority Queues. Priority queue A stack is first in, last out A queue is first in, first out A priority queue is least-first-out –The “smallest” element.
Chapter 3 List Stacks and Queues. Data Structures Data structure is a representation of data and the operations allowed on that data. Data structure is.
Jan 12, 2012 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
Information and Computer Sciences University of Hawaii, Manoa
Review for Final Andy Wang Data Structures, Algorithms, and Generic Programming.
Topic 24 Heaps "You think you know when you can learn, are more sure when you can write even more when you can teach, but certain when you can program."
Priority Queues Dr. David Matuszek
CMSC 341 Linked Lists, Stacks and Queues. 8/3/2007 UMBC CMSC 341 LSQ 2 Implementing Your Own Linked List To create a doubly linked list as seen below.
09-1 Queues and List-Based ADT Implementations Problem Set: PS3 due Wednesday, March 7 Wellesley College CS230 Lecture 09 Monday, February 26 Handout #18.
“Never doubt that a small group of thoughtful, committed people can change the world. Indeed, it is the only thing that ever has.” – Margaret Meade Thought.
CS102 – Data Structures Lists, Stacks, Queues, Trees & HashTables. David Davenport.
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
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.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
Introduction to Collections. Collections Collections provide a way of organizing related data in a model Different types of collections have different.
“The desire for safety stands against every great and noble enterprise.” – Tacitus Thought for the Day.
JavaScript: The First Parts Part Eleven Douglas Crockford Yahoo! Inc.
1 Queues (Continued) Queue ADT Linked queue implementation Array queue implementation Circular array queue implementation Deque Reading L&C , 9.3.
COMP 103 Course Review. 2 Menu  A final word on hash collisions in Open Addressing / Probing  Course Summary  What we have covered  What you should.
Week 15 – Monday.  What did we talk about last time?  Tries.
Data Structures Intro2CS – week Stack ADT (Abstract Data Type) A container with 3 basic actions: – push(item) – pop() – is_empty() Semantics: –
CS2005 Week 7 Lectures Set Abstract Data Type.
Linked Data Structures
Fundamentals of Programming II Overview of Collections
Week 4 - Friday CS221.
Sorted Linked List Same objective as a linked list, but it should be sorted Sorting can be custom according to the type of nodes Offers speedups over non-sorted.
COMP 53 – Week Eleven Hashtables.
Linked List Stacks, Linked List Queues, Dequeues
Storage Strategies: Dynamic Linking
Thought for the Day “Without leaps of imagination, or dreaming, we lose the excitement of possibilities. Dreaming, after all, is a form of planning.”
Week 3 - Friday CS221.
Week 15 – Monday CS221.
CS 2511 Fall 2014 Binary Heaps.
Trees Tree nomenclature Implementation strategies Traversals
Hashing Exercises.
Priority Queue.
Linked lists Motivation: we can make arrays, but their functionality is slightly limited and can be difficult to work with Biggest issue: size management.
Programmazione I a.a. 2017/2018.
8-1.
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.
Heaps & Priority Queues
Basic Data Types Queues
Stacks Linked Lists Queues Heaps Hashes
8-1.
Queue, Deque, and Priority Queue Implementations
Queue, Deque, and Priority Queue Implementations
THURSDAY, OCTOBER 17 IN LAB
Chapter 15 Lists Objectives
A Data Structure Bestiary
- Alan Perlis Topic 24 Heaps "You think you know when you can learn,
Recitation 5 CS0445 Data Structures
Priority Queues.
ADT list.
ADTs so far.
A Heap Implementation Chapter 26 Adapted from Pearson Education, Inc.
Priority Queues.
Priority Queues.
Ordered Structures Wellesley College CS230 Lecture 10
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Abstract Data Types (ADTs)
Presentation transcript:

A Data Structure Bestiary Views from around the web

Arrays

Strings

Tuples

Singly-linked lists

Simple list implementation Sample methods: Test if list is empty Look at the value in a node Go to the next node (if any) Add a new node to the beginning Remove a node from the beginning class Node<V> { V value; Node next; // constructor… // methods… } class List { Node<V> head = null; // methods… }

Node class Node<V> { private V value; private Node<V> next; Node(V value, Node next) { this.value = value; this.next = next; } V value() { return value; } boolean hasNext() { return next != null; } Node next() { return next; } }

List public class List<V> { private Node<V> head = null; boolean isEmpty() { return head == null; } Node<V> first() { return head; } void add(V val) { head = new Node<V>(val, head); } void remove() throws NullPointerException { head = head.next; } } Not the best implementation. Instead of exposing Node, Node could be an inner class, and List could implement Iterable.

Doubly-linked lists

Stacks

Queues

Priority queues

Deques

Maps

Sets

Hash tables (buckets)

Hash maps (buckets)

Hash maps (open addressing)

Binary trees

Search trees

Heaps

The other kind of heap next = 0 size = 2 size = 6 //////////// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 free

Trees

Parse trees

Tries

Diected graphs (Digraphs)

Undirected graphs

Data structures as tools A more complete toolset Arrays (or lists) alone

The End