CS Data Structures II Review COSC 2006 April 14, 2017

Slides:



Advertisements
Similar presentations
STACKS & QUEUES. Stacks Abstract data types An abstract data type (ADT) is an abstraction of a data structure An ADT specifies : –Data stored –Operations.
Advertisements

COSC 1P03 Data Structures and Abstraction 9.1 The Queue Whenever you are asked if you can do a job, tell 'em, "Certainly, I can!" Then get busy and find.
Stacks, Queues, and Deques. 2 A stack is a last in, first out (LIFO) data structure Items are removed from a stack in the reverse order from the way they.
Chapter 3: Abstract Data Types Lists, Stacks Lydia Sinapova, Simpson College Mark Allen Weiss: Data Structures and Algorithm Analysis in Java.
Chapter 7 Queues. © 2005 Pearson Addison-Wesley. All rights reserved7-2 The Abstract Data Type Queue A queue –New items enter at the back, or rear, of.
Data Structures & Algorithms
© 2006 Pearson Addison-Wesley. All rights reserved8-1 Chapter 8 Queues CS102 Sections 51 and 52 Marc Smith and Jim Ten Eyck Spring 2008.
Data Structures: Lists i206 Fall 2010 John Chuang Some slides adapted from Glenn Brookshear, Brian Hayes, or Marti Hearst.
© 2006 Pearson Addison-Wesley. All rights reserved7A-1 Chapter 7 Stacks.
1 CSCD 326 Data Structures I Stacks. 2 Data Type Stack Most basic property: last item in (most recently inserted) is first item out LIFO - last in first.
CS 206 Introduction to Computer Science II 10 / 26 / 2009 Instructor: Michael Eckmann.
1 Data Structures  We can now explore some advanced techniques for organizing and managing information  Chapter 12 of the book focuses on: dynamic structures.
Stack: Linked List Implementation Push and pop at the head of the list New nodes should be inserted at the front of the list, so that they become the top.
Chapter 7 Queues. © 2005 Pearson Addison-Wesley. All rights reserved7-2 The Abstract Data Type Queue A queue –New items enter at the back, or rear, of.
Stacks, Queues, and Deques
1 Stack Data : a collection of homogeneous elements arranged in a sequence. Only the first element may be accessed Main Operations: Push : insert an element.
Stacks, Queues, and Deques
© 2004 Pearson Addison-Wesley. All rights reserved12-1 Chapter 12 : Collections Intermediate Java Programming Summer 2007.
© 2006 Pearson Addison-Wesley. All rights reserved7A-1 Chapter 7 Stacks.
Chapter 7 Stacks II CS Data Structures I COSC 2006
CHAPTER 05 Compiled by: Dr. Mohammad Omar Alhawarat Stacks & Queues.
© 2006 Pearson Addison-Wesley. All rights reserved8 A-1 Chapter 8 Queues (slightly modified by Dan Fleck)
DATA STRUCTURES AND ALGORITHMS Lecture Notes 4 Prepared by İnanç TAHRALI.
Chapter 7 Stacks. © 2004 Pearson Addison-Wesley. All rights reserved 7-2 The Abstract Data Type: Developing an ADT During the Design of a Solution Specifications.
1 Stacks. 2 A stack has the property that the last item placed on the stack will be the first item removed Commonly referred to as last-in, first-out,
© 2006 Pearson Addison-Wesley. All rights reserved8 A-1 Chapter 8 Queues.
1 Chapter 7 Stacks and Queues. 2 Stack ADT Recall that ADT is abstract data type, a set of data and a set of operations that act upon the data. In a stack,
Data Structures (part 2). Stacks An Everyday Example Your boss keeps bringing you important items to deal with and keeps saying: “Put that last ‘rush’
Data Abstraction and Problem Solving with JAVA Walls and Mirrors Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Data Abstraction and Problem.
1 Stacks and Queues Based on D.S. Malik, Java Programming: Program Design Including Data Structures.
Lab 7 Queue ADT. OVERVIEW The queue is one example of a constrained linear data structure. The elements in a queue are ordered from least recently added.
Chapter 8 Queue I CS Data Structures I COSC2006 April 24, 2017
Stacks And Queues Chapter 18.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
The Abstract Data Type Queue A queue New items enter at the back, or rear, of the queue Items leave from the front of the queue First-in, first-out (FIFO)
1 Lecture 14: Queues Lecturer: Santokh Singh CompSci 105 SS 2005 Principles of Computer Science.
Chapter 5 Linked Lists II
Chapter 8 Queues. © 2004 Pearson Addison-Wesley. All rights reserved 8-2 The Abstract Data Type Queue A queue –New items enter at the back, or rear, of.
CS Data Structures I Chapter 7 Queue I. 2 Topics Introduction Queue Application Implementation Linked List Array ADT List.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 7: Queues Data Abstraction & Problem Solving with C++
CS2006- Data Structures I Chapter 5 Linked Lists III.
© 2011 Pearson Addison-Wesley. All rights reserved 8 B-1 Chapter 8 (continued) Queues.
April 27, 2017 COSC Data Structures I Review & Final Exam
Copyright © Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java From Control Structures through Data Structures by Tony.
Chapter 4 ADTs Stack and Queue. 4-2 Formal ADT Specifications The Java interface construct lets us collect together method interfaces into a syntactic.
M180: Data Structures & Algorithms in Java Stacks Arab Open University 1.
Chapter 7 A Queues. © 2004 Pearson Addison-Wesley. All rights reserved7 A-2 The Abstract Data Type Queue A queue –New items enter at the back, or rear,
List Structures What is a list? A homogeneous collection of elements with a linear relationship between the elements linear relationship - each element.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 7: Queues Data Abstraction & Problem Solving with C++
Data Abstraction and Problem Solving with JAVA Walls and Mirrors Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Data Abstraction and Problem.
Chapter 7 Stacks © 2006 Pearson Addison-Wesley. All rights reserved 7A-1.
Chapter 6 A Stacks. © 2004 Pearson Addison-Wesley. All rights reserved6 A-2 The Abstract Data Type: Developing an ADT During the Design of a Solution.
Queues Chapter 8 (continued)
Data Abstraction & Problem Solving with C++
CC 215 Data Structures Queue ADT
CS2006- Data Structures I Chapter 5 Linked Lists I.
Stacks and Queues.
Queues Queues Queues.
Stack and Queue APURBO DATTA.
structures and their relationships." - Linus Torvalds
Pointers and Linked Lists
Stacks, Queues, and Deques
Figure 7.1 Some queue operations. Figure 7.1 Some queue operations.
Chapter 8 Queues © 2006 Pearson Addison-Wesley. All rights reserved.
Queues cont. Chapter 8 © 2011 Pearson Addison-Wesley. All rights reserved.
Stacks, Queues, and Deques
Queues Chapter 8 © 2011 Pearson Addison-Wesley. All rights reserved.
structures and their relationships." - Linus Torvalds
Chapter 7 © 2011 Pearson Addison-Wesley. All rights reserved.
Queues.
Presentation transcript:

CS2007 - Data Structures II Review COSC 2006 April 14, 2017 Chapter 3: Data Abstraction. The Walls

Review When you declare a variable that refers to an object of a given class, you are creating a(n) ______ to the object. interface reference Method ADT

Review A reference variable whose sole purpose is to locate the first node in a linked list is called ______. top front head first

Review A reference variable declared as a data field within a class has the default value ______. -1 null empty

Review If you attempt to use a reference variable before it is instantiated, a(n) ______ will be thrown. IndexOutOfBoundsException InstantiationException IllegalAccessException NullPointerException

Review According to the principle of information hiding, the data fields of a class must be declared as ______. public protected private abstract

Review The last node of a linear linked list ______. has the value null has a next reference whose value is null has a next reference which references the first node of the list cannot store any data

Review A reference variable whose sole purpose is to locate the first node in a linked list is called ______. top front head first

Review An array-based implementation of an ADT list ______. requires less memory to store an item than a reference-based implementation is not a good choice for a small list has a variable size has items which explicitly reference the next items

Review In all circular linked lists, ______. every node references a predecessor every node references a successor the next reference of the last node has the value null each node references both its predecessor and its successor

Review If the array: 6, 2, 7, 13, 5, 4 is added to a stack, in the order given, which number will be the first number to be removed from the stack? 6 2 5 4

Review The ______ method of the ADT stack adds an item to the top of the stack. createStack push pop peek

Review If a stack is used by an algorithm to check for balanced braces, which of the following is true once the end of the string is reached? the stack is empty the stack has one “{” the stack has one “}” the stack has one “{” and one “}”

Review The pop operation throws a StackException when it tries to ______. add an item to an empty stack add an item to an array-based implementation of a stack that is already full delete an item from an array-based implementation of a stack that is already full delete an item from an empty stack

Review The push operation throws a StackException when it tries to ______. add an item to an empty stack add an item to an array-based implementation of a stack that is already full delete an item from an array-based implementation of a stack that is already full delete an item from an empty stack

Review In the StackInterface class, the pop method returns an item that is an instance of ______. Integer Double String Object

Review StackInterface provides the specifications for ______. only the array-based implementation of a stack only the reference-based implementation of a stack only an implementation of a stack that uses the ADT list all the implementations of a stack

Review Which of the following ADTs is like a line of people? list stack queue tree

Review Operations on a queue can be carried out at ______. its front only its back only both its front and back any position in the queue

Review The ______ operation retrieves the item that was added earliest to a queue, but does not remove that item. enqueue dequeue dequeueAll peek

Review A reference-based implementation of a queue that uses a linear linked list would need at least ______ external references. one two three four

Review Which of the following methods of QueueInterface does NOT throw a QueueException? enqueue dequeue dequeueAll peek

Review If a queue is implemented as the ADT list, which of the following queue operations can be implemented as list.get(1)? enqueue() dequeue() isEmpty() peek()

Review The ADT ______ allows you to insert into, delete from, and inspect the item at any position of the ADT. stack queue List array

Review The enqueue operation of the ADT queue is similar to the ______ operation of the ADT stack. isEmpty peek push pop

Review Which of the following is an operation of the ADT list? pop dequeue peek remove