0% found this document useful (0 votes)
18 views7 pages

Dynamic Sets & Data Structures Guide

The document discusses data structures and their implementations. It covers fundamental data structures like stacks, queues, priority queues, and dictionaries. It also discusses how these are implemented in standard libraries for languages like Java, C++, C#, and Python.

Uploaded by

ims
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views7 pages

Dynamic Sets & Data Structures Guide

The document discusses data structures and their implementations. It covers fundamental data structures like stacks, queues, priority queues, and dictionaries. It also discusses how these are implemented in standard libraries for languages like Java, C++, C#, and Python.

Uploaded by

ims
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 7

Data Structures - Review

[CLRS] – Chap 10, Chap 11, Chap 6.5

[CLRS] = Thomas H. Cormen, Charles E. Leiserson,


Ronald L. Rivest and Clifford Stein, Introduction to
Algorithms, 3rd Ed, MIT Press, 2009.
Data Structures
• Program = Algorithm + Data Structures
• The design of an algorithm must be based on the
understanding of data structure techniques and costs
• Abstract Data Type:
– Defined by the list of supported operations
– Hides the implementation details of these operations
Dynamic Sets
• Collections of data manipulated by algorithms;
can grow, shrink or change over time
• Operations on dynamic sets: S=a dynamic set
– Search (S, k)
– Insert (S, x)
– Delete (S, x)
– Minimum (S)
– Maximum(S)
– Successor(S, x)
– Predecessor(S, x)
Implementing Dynamic Sets
• The best way to implement a dynamic set is
determined by the subset of operations that
must be supported !
• There are particular types of Dynamic Sets,
determined by certain frequent occuring subsets
of operations: The Fundamental Data Structures
– Each data structure addresses comes with a purpose:
it addresses a particular usage context that requires
a particular subset of operations
Fundamental Data Structures
• Stacks:
– Insert (Push), Delete (Pop)
– Implemented by Lists; O(1), O(1)
• Queues:
– Insert (Enqueue), Delete (Dequeue)
– Implemented by Lists; O(1), O(1)
• Priority Queues: see for review [CLRS chap 6.5]
– Insert, Maximum, ExtractMax, IncreaseKey
– Implemented by Heaps; O(log n), O(1), O(log n), O(log n)
• Dictionaries:
– Insert, Search, Delete
– Implemented by Hashtables: see for review [CLRS chap 11]
– Generalizes the simple arrays, allows direct addressing of arbitrary
positions in O(1)
– Hashing with chaining; Hashing with open addressing
Libraries Implementing
Fundamental Data Structures
• There are standard libraries implementing the fundamental data
structures for most languages
• It is recommended to use these implementations instead of redoing
your own !
• BUT: in order to use them correct and appropriate, don’t forget
anything that you learned about fundamental data structures !

• Java: Collections
– https://docs.oracle.com/javase/tutorial/collections/TOC.html
• C++: STL Containers
– http://www.cplusplus.com/reference/stl/
• C#: System.Collections
– https://msdn.microsoft.com/en-US/library/system.collections
%28v=vs.110%29.aspx
• Python: non-primitive types list, set, dict
– https://docs.python.org/3/library/stdtypes.html
Fundamental Data Structures - Java
• Class java.util.Stack
• Interface java.util.Queue
– General purpose (not for concurrent use) queue implementation:
class java.util.LinkedList
• Interface java.util.Deque
– General purpose implementations: classes java.util.ArrayDeque,
java.util.LinkedList
• Class java.util.PriorityQueue
– Implements an unbounded priority queue based on a Heap.
• Class java.util.HashSet
• Class java.util.HashMap

You might also like