Class 32: The Java Collections Framework
|
|
|
- Hugh Small
- 9 years ago
- Views:
Transcription
1 Introduction to Computation and Problem Solving Class 32: The Java Collections Framework Prof. Steven R. Lerman and Dr. V. Judson Harward Goals To introduce you to the data structure classes that come with the JDK; To talk about how you design a library of related classes To review which data structures are the best tools for a variety of algorithmic tasks 2 1
2 History In the original version of the Java Development Kit, JDK 1.0, developers were provided very few data structures. These were: Vector Stack: which extended Vector Hashtable: very similar to our implementation of HashMap Dictionary: an abstract class that defined the interface and some functionality for classes that map keys to values. Dictionary served as the base class for Hashtable. Enumeration: was a simple version of our Iterator that allowed you to iterate over instances of Hashtable and Vector. 3 The Java Collections Framework The Java designers realized that this set of data structures was inadequate. They prototyped a new set of data structures as a separate toolkit late in JDK 1.1, and then made it a formal part of the JDK in version 1.2. This later, fuller, better designed set of classes is called the Java Collections Framework. There is a good tutorial on its use at s/index.html. 4 2
3 Collections Interfaces, 1 Collection Map Set List SortedMap SortedSet Iterator 5 ListIterator Collections Interfaces, 2 Collection: is the most basic interface; it has the functionality of an unordered list, aka a multiset, a set that doesn t not check for duplicates. Set: adds set semantics; that is, it won't allow duplicate members. List: adds list semantics; that is, a sense of order and position SortedSet: adds order to set semantics; our binary search tree that just consisted of keys without values could be implemented as a SortedSet 6 3
4 Collections Interfaces, 3 Map: the basic interface for data structures that map keys to values; it uses an inner class called an Entry SortedMap: a map of ordered keys with values; our binary search tree is a good example Iterator: our Iterator except that it is fail fast; it throws a ConcurrentModificationException if you use an instance after the underlying Collection has been modified. ListIterator: a bidirectional iterator. 7 Collection Implementations The Java designers worked out the architecture of interfaces independently of any data structures. In a second stage they created a number of concrete implementations of the interfaces based on slightly more sophisticated versions of the data structures that we have been studying: Resizable Array: similar to the technique used for our Stack implementation. Linked List: uses a doubly, not singly, linked list. Hash Table: very similar to our implementation except that it will grow the number of slots once the load factor passes a value that can be set in the constructor. Balanced Tree: similar to our binary search tree implementation but based on the more sophisticated Red- Black tree that rebalances the tree after some operations. 8 4
5 Collection Implementations, 2 Implementations Hash Table Resizable Array Balanced Tree Linked List List Array- List Linked- List Set HashSet Interfaces SortedSet Set TreeSet Map HashMap 9 Sorted Map TreeMap Collection Implementations, 3 Notice the gaps. There is no list based on a hash table. Why? What about a set implementation based on a linked list? The goal of the Java designers was to create a small set of implementations to get users started, not an exhaustive set. They expect that developers will extend the set of collection classes just as they expect that developers will add more stream classes. The most important part of the collection design was the architecture of interfaces. That's why they called it a framework. 10 5
6 Implementation Choices Be careful of implementation choices. Not all the implementations are going to be efficient at all their operations. For instance, an ArrayList will allow you to remove its first element by calling remove( 0 ). We already know this will be particularly inefficient. You can also iterate over a LinkedList, l, using the following code, but once again it will be very inefficient. Why? for ( int i = 0; i < l.size(); i++ ) { Object o = l.get( i ); // do what you need with o 11 Collection Interface public interface Collection { // Query Operations int size(); boolean isempty(); boolean contains(object o); boolean containsall(collection c); Iterator iterator(); Object[] toarray(); Object[] toarray(object a[]); boolean equals(object o); int hashcode(); 12 6
7 Collection Interface, 2 // Modification Operations boolean add(object o); boolean remove(object o); boolean addall(collection c); boolean removeall(collection c); boolean retainall(collection c); void clear(); 13 Bulk Operations Note the bulk operations. All the interfaces derived from Collection support them: boolean containsall( Collection c ) boolean addall( Collection c ) boolean removeall( Collection c ) boolean retainall( Collection c ) containsall() returns true if the target of the method contains all the elements in the argument collection. The other three methods return true if the operation changes the target collection. 14 7
8 Bulk Constructors All Collection (Map) implementations support at least two constructors. a default constructor that creates an empty Collection (Map) of the appropriate type, and a constructor that takes a Collection (Map) argument that creates a Collection (Map) of the appropriate type that contains references to all the objects in the Collection (Map) supplied as the argument. 15 Array Operations All Collection implementations also possess a method with the signature: Object [] toarray() which returns the contents of the collection in an appropriately sized array. A variant Object[] toarray(object a[]); returns all the elements of the collection that match the type of the array, a[], in a[] itself or an appropriately sized array of the same type. 16 8
9 Array Examples Collection c = new HashSet(); // put things in c String[] s = (String[]) c.toarray(new String[0]); returns all the String elements of c in an array of Strings. Collection c = new HashSet(); // if c contains only Strings String[] s = (String[]) c.toarray( ); 17 List Interface public interface List extends Collection { // adds the following to Collection boolean addall(int index, Collection c); Object get(int index); Object set(int index, Object element); void add(int index, Object element); Object remove(int index); int indexof(object o); int lastindexof(object o); ListIterator listiterator(); ListIterator listiterator(int index); List sublist(int fromindex, int toindex); 18 9
10 Views Several of the interfaces also support view operations. In a view operation, a collection returns another collection that provides a specialized and usually partial view of its contents. A good example is List sublist( int from, int to ) This method returns a second list that starts with the from'th element of the parent list and ends just before the to'th element. But the returned sublist is not a copy. It remains part of the original list. As an example, an elegant way to delete the 4th through 10th elements of a list is the following: mylist.sublist( 3, 10 ).clear(); 19 Set Interface public interface Set extends Collection { // has the same methods as Collection // but with stricter semantics 20 10
11 SortedSet Interface public interface SortedSet extends Set { // adds the following to Set Comparator comparator(); SortedSet subset(object fromelement, Object toelement); SortedSet headset(object toelement); SortedSet tailset(object fromelement); Object first(); Object last(); 21 Iterator Interface public interface Iterator { boolean hasnext(); Object next(); void remove(); 22 11
12 ListIterator Interface public interface ListIterator extends Iterator { // adds the following to Iterator boolean hasprevious(); Object previous(); int nextindex(); int previousindex(); void set(object o); void add(object o); 23 Concurrent Modification Iterators have to keep references to the underlying data structure to maintain their sense of current position. Thought experiment: create a LinkedList, add elements, get an iterator, advance it now using a method in the list not the iterator, delete the iterator's next item now call next() on the iterator what goes wrong? Any time you create an iterator, modify the underlying collection, and then use the iterator, you will get a ConcurrentModificationException. How do you think they implement the check? 24 12
13 Concurrent Modification, Before List Iterator first last current next Link Link Link Link null Item Item Item Item 25 Concurrent Modification, After List Iterator first last current next Link Link? Link null Item Item Item 26 13
14 Map Interface public interface Map { // Query Operations int size(); boolean isempty(); boolean containskey(object key); boolean containsvalue(object value); Object get(object key); 27 Map Interface, 2 // Modification Operations Object put(object key, Object value); Object remove(object key); void putall(map t); void clear(); // Views public Set keyset(); public Collection values(); public Set entryset(); boolean equals(object o); int hashcode(); 28 14
15 Nested Map.Entry Interface public interface Entry { Object getkey(); Object getvalue(); Object setvalue(object value); boolean equals(object o); int hashcode(); 29 Map Views Maps also provide views. In fact they are crucial because a Map does not provide an iterator() method. They are two separate idioms for iterating over a Map, depending on whether you want to iterate over the keys or the values: Map m =...; // iterates over keys for (Iterator i=m.keyset().iterator(); i.hasnext();) {... // iterates over values for (Iterator i=m.values().iterator(); i.hasnext();) {... In the second example, values() returns a Collection, not a Set, because the same value can occur multiple times in a map while a key must be unique
16 SortedMap Interface public interface SortedMap extends Map { // adds the following to Map Comparator comparator(); SortedMap submap(object fromkey, Object tokey); SortedMap headmap(object tokey); SortedMap tailmap(object fromkey); Object firstkey(); Object lastkey(); 31 Optional Operations Not all implementations implement all the operations in an interface. The documentation makes it clear whether a particular implementation implements a given method. If it doesn't, it throws an UnsupportedOperationException (unchecked). At first, this just seems perverse, but the goal is to provide more flexibility. Imagine a program where you want to maintain a master index in which you want a normal user to be able to look up entries but only a privileged user to add entries to the index. The index could be implemented as a SortedMap, but then how could you keep an arbitrary user from adding and deleting entries? The answer is to subclass SortedMap and override each method you wanted to forbid with a simple method that throws an UnsupportedOperationException
17 Algorithms The Collections class contains implementations of a number of useful algorithms implemented as static methods that take a List or sometimes a more general Collection as the target of the algorithm. Algorithms include sort(), reverse(), min(), max(), fill(object o), etc. static void sort( List l, Comparator c ) static void fill( List l, Object o ) There is a similar class Arrays, which implements most of the same algorithms for arrays. 33 Read-Only Collections Collections can also produce unmodifiable (read only) views of all types of collections that will throw an UnsupportedOperationException on any write operation: public static Collection unmodifiablecollection(collection c); public static Set unmodifiableset(set s);
Collections in Java. Arrays. Iterators. Collections (also called containers) Has special language support. Iterator (i) Collection (i) Set (i),
Arrays Has special language support Iterators Collections in Java Iterator (i) Collections (also called containers) Collection (i) Set (i), HashSet (c), TreeSet (c) List (i), ArrayList (c), LinkedList
Data Structures in the Java API
Data Structures in the Java API Vector From the java.util package. Vectors can resize themselves dynamically. Inserting elements into a Vector whose current size is less than its capacity is a relatively
Working with Java Collections
Working with Java Collections Java 2 Collections Lists - linear, supporting many operations Sets - unordered, unique items Sorted sets - like sets, but items can be visited in sorted order Java 2 Collections
JAVA COLLECTIONS FRAMEWORK
http://www.tutorialspoint.com/java/java_collections.htm JAVA COLLECTIONS FRAMEWORK Copyright tutorialspoint.com Prior to Java 2, Java provided ad hoc classes such as Dictionary, Vector, Stack, and Properties
The Java Collections Framework
The Java Collections Framework Definition Set of interfaces, abstract and concrete classes that define common abstract data types in Java e.g. list, stack, queue, set, map Part of the java.util package
Data Structures and Algorithms
Data Structures and Algorithms CS245-2016S-05 Abstract Data Types and Lists David Galles Department of Computer Science University of San Francisco 05-0: Abstract Data Types Recall that an Abstract Data
Generic Types in Java. Example. Another Example. Type Casting. An Aside: Autoboxing 4/16/2013 GENERIC TYPES AND THE JAVA COLLECTIONS FRAMEWORK.
Generic Types in Java 2 GENERIC TYPES AND THE JAVA COLLECTIONS FRAMEWORK Lecture 15 CS2110 Spring 2013 When using a collection (e.g., LinkedList, HashSet, HashMap), we generally have a single type T of
Per imparare a programmare bisogna programmare
Per imparare a programmare bisogna programmare Brian Kernighan Java collections framework Commonly reusable collection data structures Abstract Data Type ADTs store data and allow various operations on
Principles of Software Construction: Objects, Design and Concurrency. Java Collections. toad 15-214. Fall 2013
Principles of Software Construction: Objects, Design and Concurrency Java Collections toad 15-214 Fall 2013 Jonathan Aldrich Charlie Garrod School of Computer Science 2012-13 C Garrod, J Aldrich, and W
CMSC 202H. ArrayList, Multidimensional Arrays
CMSC 202H ArrayList, Multidimensional Arrays What s an Array List ArrayList is a class in the standard Java libraries that can hold any type of object an object that can grow and shrink while your program
API for java.util.iterator. ! hasnext() Are there more items in the list? ! next() Return the next item in the list.
Sequences and Urns 2.7 Lists and Iterators Sequence. Ordered collection of items. Key operations. Insert an item, iterate over the items. Design challenge. Support iteration by client, without revealing
Practical Session 4 Java Collections
Practical Session 4 Java Collections Outline Working with a Collection The Collection interface The Collection hierarchy Case Study: Undoable Stack The Collections class Wrapper classes Collection A group
Chapter 8: Bags and Sets
Chapter 8: Bags and Sets In the stack and the queue abstractions, the order that elements are placed into the container is important, because the order elements are removed is related to the order in which
CSE 2123 Collections: Sets and Iterators (Hash functions and Trees) Jeremy Morris
CSE 2123 Collections: Sets and Iterators (Hash functions and Trees) Jeremy Morris 1 Collections - Set What is a Set? A Set is an unordered sequence of data with no duplicates Not like a List where you
Lecture 2: Data Structures Steven Skiena. http://www.cs.sunysb.edu/ skiena
Lecture 2: Data Structures Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena String/Character I/O There are several approaches
D06 PROGRAMMING with JAVA
Cicles Formatius de Grau Superior Desenvolupament d Aplicacions Informàtiques D06 PROGRAMMING with JAVA Ch20 Data Structures I PowerPoint presentation, created by Angel A. Juan - ajuanp(@)gmail.com, for
Basic Programming and PC Skills: Basic Programming and PC Skills:
Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of
Java SE 8 Programming
Oracle University Contact Us: 1.800.529.0165 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features and Application Programming
Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013
Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper
Data Structures and Algorithms Lists
Data Structures and Algorithms Lists Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/19 5-0: Abstract Data Types An
Software Development with UML and Java 2 SDJ I2, Spring 2010
Software Development with UML and Java 2 SDJ I2, Spring 2010 Agenda week 7, 2010 Pakages Looking back Looking forward Packages Interfaces Page 1 Spring 2010 Download, Install/Setup 1. Java SE SDK (http://java.sun.com/javase/downloads)
1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.
1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. base address 2. The memory address of fifth element of an array can be calculated
CompSci-61B, Data Structures Final Exam
Your Name: CompSci-61B, Data Structures Final Exam Your 8-digit Student ID: Your CS61B Class Account Login: This is a final test for mastery of the material covered in our labs, lectures, and readings.
Designing with Exceptions. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219
Designing with Exceptions CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Testing vs. Debugging Testing Coding Does the code work properly YES NO 2 Debugging Testing
Analysis of a Search Algorithm
CSE 326 Lecture 4: Lists and Stacks 1. Agfgd 2. Dgsdsfd 3. Hdffdsf 4. Sdfgsfdg 5. Tefsdgass We will review: Analysis: Searching a sorted array (from last time) List ADT: Insert, Delete, Find, First, Kth,
Lecture 7: Class design for security
Lecture topics Class design for security Visibility of classes, fields, and methods Implications of using inner classes Mutability Design for sending objects across JVMs (serialization) Visibility modifiers
Java Interview Questions and Answers
1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java
Introduction to Object-Oriented Programming
Introduction to Object-Oriented Programming Linked Lists Christopher Simpkins [email protected] CS 1331 (Georgia Tech) Linked Lists 1 / 12 Linked Lists Dynamic data structures Singly linked lists
Abstract Data Type. EECS 281: Data Structures and Algorithms. The Foundation: Data Structures and Abstract Data Types
EECS 281: Data Structures and Algorithms The Foundation: Data Structures and Abstract Data Types Computer science is the science of abstraction. Abstract Data Type Abstraction of a data structure on that
Iterators. Provides a way to access elements of an aggregate object sequentially without exposing its underlying representation.
Iterators Provides a way to access elements of an aggregate object sequentially without exposing its underlying representation when to use it - to access an aggregate object's contents without exposing
1 of 1 24/05/2013 10:23 AM
?Init=Y 1 of 1 24/05/2013 10:23 AM 1. Which of the following correctly defines a queue? a list of elements with a first in last out order. a list of elements with a first in first out order. (*) something
Java Map and Set collections
Java Map and Set collections Java Set container idea interface Java Map container idea interface iterator concordance example Java maps and sets [Bono] 1 Announcements Lab this week based on an example
Java Software Structures
INTERNATIONAL EDITION Java Software Structures Designing and Using Data Structures FOURTH EDITION John Lewis Joseph Chase This page is intentionally left blank. Java Software Structures,International Edition
Stacks and queues. Algorithms and Data Structures, Fall 2011. Rasmus Pagh. Based on slides by Kevin Wayne, Princeton
Algorithms and Data Structures, Fall 2011 Stacks and queues Rasmus Pagh Based on slides by Kevin Wayne, Princeton Algorithms, 4 th Edition Robert Sedgewick and Kevin Wayne Copyright 2002 2011 Stacks and
Android Application Development Course Program
Android Application Development Course Program Part I Introduction to Programming 1. Introduction to programming. Compilers, interpreters, virtual machines. Primitive data types, variables, basic operators,
CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions
CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly
A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:
Binary Search Trees 1 The general binary tree shown in the previous chapter is not terribly useful in practice. The chief use of binary trees is for providing rapid access to data (indexing, if you will)
Java EE Web Development Course Program
Java EE Web Development Course Program Part I Introduction to Programming 1. Introduction to programming. Compilers, interpreters, virtual machines. Primitive types, variables, basic operators, expressions,
Structural Design Patterns Used in Data Structures Implementation
Structural Design Patterns Used in Data Structures Implementation Niculescu Virginia Department of Computer Science Babeş-Bolyai University, Cluj-Napoca email address: [email protected] November,
Java Coding Practices for Improved Application Performance
1 Java Coding Practices for Improved Application Performance Lloyd Hagemo Senior Director Application Infrastructure Management Group Candle Corporation In the beginning, Java became the language of the
Introduction to Stacks
Introduction to Stacks What is a Stack Stack implementation using array. Stack implementation using linked list. Applications of Stack. What is a Stack? Stack is a data structure in which data is added
Big O and Limits Abstract Data Types Data Structure Grand Tour. http://gcc.gnu.org/onlinedocs/libstdc++/images/pbds_different_underlying_dss_1.
Big O and Limits Abstract Data Types Data Structure Grand Tour http://gcc.gnu.org/onlinedocs/libstdc++/images/pbds_different_underlying_dss_1.png Consider the limit lim n f ( n) g ( n ) What does it
CHAPTER 4 ESSENTIAL DATA STRUCTRURES
CHAPTER 4 ESSENTIAL DATA STRUCTURES 72 CHAPTER 4 ESSENTIAL DATA STRUCTRURES In every algorithm, there is a need to store data. Ranging from storing a single value in a single variable, to more complex
core 2 Basic Java Syntax
core Web programming Basic Java Syntax 1 2001-2003 Marty Hall, Larry Brown: http:// Agenda Creating, compiling, and executing simple Java programs Accessing arrays Looping Using if statements Comparing
C++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition
Java 6 'th edition Concepts INTERNATIONAL STUDENT VERSION CONTENTS PREFACE vii SPECIAL FEATURES xxviii chapter i INTRODUCTION 1 1.1 What Is Programming? 2 J.2 The Anatomy of a Computer 3 1.3 Translating
Introduction to Programming System Design. CSCI 455x (4 Units)
Introduction to Programming System Design CSCI 455x (4 Units) Description This course covers programming in Java and C++. Topics include review of basic programming concepts such as control structures,
KITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php [email protected] [email protected] Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
Approach of Unit testing with the help of JUnit
Approach of Unit testing with the help of JUnit Satish Mishra [email protected] About me! Satish Mishra! Master of Electronics Science from India! Worked as Software Engineer,Project Manager,Quality
Java Collection Framework hierarchy. What is Data Structure? Chapter 20 Lists, Stacks, Queues, and Priority Queues
Chapter 20 Lists, Stacks, Queues, and Priority Queues Objectives q To explore the relationship between interfaces and classes in the Java Collections Framework hierarchy ( 20.2). q To use the common methods
Questions 1 through 25 are worth 2 points each. Choose one best answer for each.
Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in
CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team
CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team Lecture Summary In this lecture, we learned about the ADT Priority Queue. A
LINKED DATA STRUCTURES
LINKED DATA STRUCTURES 1 Linked Lists A linked list is a structure in which objects refer to the same kind of object, and where: the objects, called nodes, are linked in a linear sequence. we keep a reference
Hash Tables. Computer Science E-119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Data Dictionary Revisited
Hash Tables Computer Science E-119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Data Dictionary Revisited We ve considered several data structures that allow us to store and search for data
Computing Concepts with Java Essentials
2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann
http://algs4.cs.princeton.edu dictionary find definition word definition book index find relevant pages term list of page numbers
ROBERT SEDGEWICK KEVI WAYE F O U R T H E D I T I O ROBERT SEDGEWICK KEVI WAYE ROBERT SEDGEWICK KEVI WAYE Symbol tables Symbol table applications Key-value pair abstraction. Insert a value with specified.
Symbol Tables. Introduction
Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The
Sorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)
Sorting revisited How did we use a binary search tree to sort an array of elements? Tree Sort Algorithm Given: An array of elements to sort 1. Build a binary search tree out of the elements 2. Traverse
22c:31 Algorithms. Ch3: Data Structures. Hantao Zhang Computer Science Department http://www.cs.uiowa.edu/~hzhang/c31/
22c:31 Algorithms Ch3: Data Structures Hantao Zhang Computer Science Department http://www.cs.uiowa.edu/~hzhang/c31/ Linear Data Structures Now we can now explore some convenient techniques for organizing
Efficient Data Structures for Decision Diagrams
Artificial Intelligence Laboratory Efficient Data Structures for Decision Diagrams Master Thesis Nacereddine Ouaret Professor: Supervisors: Boi Faltings Thomas Léauté Radoslaw Szymanek Contents Introduction...
Data Structures Fibonacci Heaps, Amortized Analysis
Chapter 4 Data Structures Fibonacci Heaps, Amortized Analysis Algorithm Theory WS 2012/13 Fabian Kuhn Fibonacci Heaps Lacy merge variant of binomial heaps: Do not merge trees as long as possible Structure:
Data Types. Abstract Data Types. ADTs as Design Tool. Abstract Data Types. Integer ADT. Principle of Abstraction
bstract ata Types Previous lectures: algorithms and their efficiency analysis. oming lectures: data structures In this lecture: bstract data types Ts as a design tool Examples: integer T, List T ata Types
cs2010: algorithms and data structures
cs2010: algorithms and data structures Lecture 11: Symbol Table ADT. Vasileios Koutavas 28 Oct 2015 School of Computer Science and Statistics Trinity College Dublin Algorithms ROBERT SEDGEWICK KEVIN WAYNE
Queues Outline and Required Reading: Queues ( 4.2 except 4.2.4) COSC 2011, Fall 2003, Section A Instructor: N. Vlajic
Queues Outline and Required Reading: Queues ( 4. except 4..4) COSC, Fall 3, Section A Instructor: N. Vlajic Queue ADT Queue linear data structure organized according to first-in/first-out (FIFO) principle!
DATA STRUCTURES USING C
DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give
10CS35: Data Structures Using C
CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a
BCS2B02: OOP Concepts and Data Structures Using C++
SECOND SEMESTER BCS2B02: OOP Concepts and Data Structures Using C++ Course Number: 10 Contact Hours per Week: 4 (2T + 2P) Number of Credits: 2 Number of Contact Hours: 30 Hrs. Course Evaluation: Internal
Course: Programming II - Abstract Data Types. The ADT Queue. (Bobby, Joe, Sue, Ellen) Add(Ellen) Delete( ) The ADT Queues Slide Number 1
Definition Course: Programming II - Abstract Data Types The ADT Queue The ADT Queue is a linear sequence of an arbitrary number of items, together with access procedures. The access procedures permit addition
Project 4 DB A Simple database program
Project 4 DB A Simple database program Due Date April (Friday) Before Starting the Project Read this entire project description before starting Learning Objectives After completing this project you should
STORM. Simulation TOol for Real-time Multiprocessor scheduling. Designer Guide V3.3.1 September 2009
STORM Simulation TOol for Real-time Multiprocessor scheduling Designer Guide V3.3.1 September 2009 Richard Urunuela, Anne-Marie Déplanche, Yvon Trinquet This work is part of the project PHERMA supported
Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C
Tutorial#1 Q 1:- Explain the terms data, elementary item, entity, primary key, domain, attribute and information? Also give examples in support of your answer? Q 2:- What is a Data Type? Differentiate
CMSC 132: Object-Oriented Programming II. Design Patterns I. Department of Computer Science University of Maryland, College Park
CMSC 132: Object-Oriented Programming II Design Patterns I Department of Computer Science University of Maryland, College Park Design Patterns Descriptions of reusable solutions to common software design
Course: Programming II - Abstract Data Types. The ADT Stack. A stack. The ADT Stack and Recursion Slide Number 1
Definition Course: Programming II - Abstract Data Types The ADT Stack The ADT Stack is a linear sequence of an arbitrary number of items, together with access procedures. The access procedures permit insertions
Author: Sascha Wolski Sebastian Hennebrueder http://www.laliluna.de/tutorials.html Tutorials for Struts, EJB, xdoclet and eclipse.
JUnit Testing JUnit is a simple Java testing framework to write tests for you Java application. This tutorial gives you an overview of the features of JUnit and shows a little example how you can write
Ordered Lists and Binary Trees
Data Structures and Algorithms Ordered Lists and Binary Trees Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/62 6-0:
1.00 Lecture 35. Data Structures: Introduction Stacks, Queues. Reading for next time: Big Java: 15.1-15.3. Data Structures
1.00 Lecture 35 Data Structures: Introduction Stacks, Queues Reading for next time: Big Java: 15.1-15.3 Data Structures Set of reusable classes used in algorithms, simulations, operating systems, applications
Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.
Arrays Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html 1 Grid in Assignment 2 How do you represent the state
C++ Programming Language
C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract
Lecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 17 October 23, 2014 1 Introduction In this lecture, we will continue considering associative
Last not not Last Last Next! Next! Line Line Forms Forms Here Here Last In, First Out Last In, First Out not Last Next! Call stack: Worst line ever!
ECE 551 C++ Programming, Data structures, and Algorithms Abstract Data Type: Stack Last In First Out (LIFO) 1 2 2 1 4 3 1 3 4 Stacks in Programming Worst line ever! 5 3 1 5 Stacks are not useful for waiting
Java Training - A Brief Summary of Objects
Java training An Introduction to Java dec 2010 Francois de Coligny Samuel Dufour INRA - UMR AMAP Botany and computational plant architecture Java training > contents Java training - Contents Introduction
Semantic Analysis: Types and Type Checking
Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors
Chapter 13: Query Processing. Basic Steps in Query Processing
Chapter 13: Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 13.1 Basic Steps in Query Processing 1. Parsing
The ADT Binary Search Tree
The ADT Binary Search Tree The Binary Search Tree is a particular type of binary tree that enables easy searching for specific items. Definition The ADT Binary Search Tree is a binary tree which has an
Lecture 12 Doubly Linked Lists (with Recursion)
Lecture 12 Doubly Linked Lists (with Recursion) In this lecture Introduction to Doubly linked lists What is recursion? Designing a node of a DLL Recursion and Linked Lists o Finding a node in a LL (recursively)
Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2015 The third
WORKSPACE WEB DEVELOPMENT & OUTSOURCING TRAINING CENTER
WORKSPACE WEB DEVELOPMENT & OUTSOURCING TRAINING CENTER Course Outline (2015) Basic Programming With Procedural & Object Oriented Concepts (C, C++) Training Office# Road: 11, House: 1 A, Nikunja 2, Khilkhet,
Java the UML Way: Integrating Object-Oriented Design and Programming
Java the UML Way: Integrating Object-Oriented Design and Programming by Else Lervik and Vegard B. Havdal ISBN 0-470-84386-1 John Wiley & Sons, Ltd. Table of Contents Preface xi 1 Introduction 1 1.1 Preliminaries
Introduction: Abstract Data Types and Java Review
Introduction: Abstract Data Types and Java Review Computer Science E-119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Welcome to Computer Science E-119! We will study fundamental data structures.
Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2014 Jill Seaman
Java Programming Language
Lecture 1 Part II Java Programming Language Additional Features and Constructs Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Subclasses and
Computer. Course Description
Computer Science Computer Science A Computer Science AB Course Description May 2009 The College Board: Connecting Students to College Success The College Board is a not-for-profit membership association
CS 111 Classes I 1. Software Organization View to this point:
CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects
Génie Logiciel et Gestion de Projets. Refactoring
Génie Logiciel et Gestion de Projets Refactoring 1 Make it Work, Make it Right, Make it Fast Roadmap What is refactoring? Why is it necessary? Some Examples When to refactor? Bad Smells Catalog of Refactorings
Loops and ArrayLists
Chapter 6 Loops and ArrayLists What is in this Chapter? When programming, it is often necessary to repeat a selected portion of code a specific number of times, or until some condition occurs. We will
