Save this PDF as:

Size: px
Start display at page:

Transcription

1 Arrays and Linked Lists Data Structures and Algorithms Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++ Goodrich, Tamassia and Mount (Wiley, 2004)

3 Arrays Built-in in most programming languages Two kinds (programmer responsibility): Unordered: attendance tracking Ordered: high scorers Operations: Insertion Deletion Search Linked Lists 3

4 Arrays Operation Unordered Ordered Insertion O(1) O(n) Deletion O(n) O(n) Search O(n) O(logn) Pluses & minuses + Fast element access; simple -- Impossible to resize; slow deletion Many applications require resizing! Required size not always immediately available. Linked Lists 4

5 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An ADT specifies: Data stored Operations on the data Error conditions associated with operations Linked Lists 5

6 Abstract Data Types - Example An ADT modeling a simple stock trading system Data stored: buy/sell orders Operations on the data: order buy(stock, shares, price) order sell(stock, shares, price) void cancel(order) Error conditions: Buy/sell a nonexistent stock Cancel a nonexistent order Linked Lists 6

7 Position ADT The Position ADT models the notion of place within a data structure where a single object is stored It gives a unified view of diverse ways of storing data, such as a cell of an array a node of a linked list Just one method: Object * getelement(): returns the element stored at the position Linked Lists 7

8 List ADT The List ADT models a sequence of positions storing arbitrary objects It establishes a before/after relation between positions Generic methods: size(), isempty() Accessor methods: first(), last() prev(p), next(p) Update methods: replace(p, e) insertbefore(p, e), insertafter(p, e), insertfirst(e), insertlast(e) remove(p) Linked Lists 8

9 Singly Linked Lists A singly linked list is a concrete data structure consisting of a sequence of nodes Each node stores element link to the next node element next node A B C D Linked Lists 9

10 Node struct struct Node { // Instance variables Object* element; Node* next; next } // Initialize a node Node() { this(null, null); } Node(Object* e, Node* n) { element = e; next = n; } element node Linked Lists 10

11 Singly linked list struct SLinkedList { Node* head; // head node of the list long size; // number of nodes in the list }; /* Default constructor that creates an empty list */ SLinkedList() { head = null; size = 0; } //... update and search methods would go here... boolean isempty() {return head ==null; } void insertafter(node * node, Object* element) {...}... Linked Lists 11

12 Inserting at the Head head Rome Seattle Toronto 1. Allocate a new node 2. Insert new element 3. Make new node point to old head Vienna head Rome Seattle Toronto head 4. Update head to point to new node Vienna Rome Seattle Toronto Linked Lists 12

13 Algorithm addfirst Algorithm addfirst(v) Input node v to be added to the beginning of the list Output v.setnext (head) {make v point to the old head node} head v {make variable head point to new node} size size + 1 {increment the node count} Linked Lists 13

14 Removing at the Head head Vienna Rome Seattle Toronto head 1. Update head to point to next node in the list 2. Disallocate the former first node Vienna Rome Seattle Toronto the garbage collector to reclaim (Java), or head the programmer does the job (C/C++) Rome Seattle Toronto Linked Lists 14

15 Algorithm removefirst Algorithm removefirst() if head = null then Indicate an error: the list is empty t head head head.getnext() {make head point to next node or null} Disallocate node t size size - 1 {decrement the node count} {null out t's next pointer or free t's memory} Linked Lists 15

16 Singly linked list with tail sentinel head tail struct SLinkedListWithTail { Node* head; // head node Node* tail; // tail node of the list Rome Seattle Toronto } /* Default constructor that creates an empty list */ SLinkedListWithTail() { head = null; tail = null; } //... update and search methods would go here... Linked Lists 16

17 Inserting at the Tail head tail 1. Allocate a new node 2. Insert new element 3. Have new node point to null Rome Seattle Toronto head tail Rome Seattle Toronto Zurich 4. Have old last node point to new node 5. Update tail to point to new node head Rome tail Seattle Toronto Zurich Linked Lists 17

18 Algorithm addlast Algorithm addlast(v) Input node v to be added to the end of the list Output v.setnext (NULL) {make new node v point to null object} tail.setnext(v) {make old tail node point to new node} tail size; size size + 1 {make variable tail node point to new node} {increment the node count} Linked Lists 18

19 Removing at the Tail Removing at the tail of a singly linked list cannot be efficient! There is no constant-time way to update the tail to point to the previous node head tail Rome Seattle Toronto Zurich Linked Lists 19

20 Doubly Linked List A doubly linked list is often more convenient! Nodes store: element link to the previous node link to the next node Special trailer and header nodes prev elem next node header nodes/positions trailer elements Linked Lists 20

21 Node struct prev next elem node /* Node of a doubly linked list of strings */ struct DNode { string* element; DNode *next, *prev; // Pointers to next and previous node }; /* Initialize a node. */ DNode(string* e, DNode* p, DNode *n) { element = e; prev = p; next = n; } string* getelement() { return element; } Linked Lists 21

22 Class for doubly linked list struct DList { DNode* header, *trailer; // sentinels long size; // number of nodes in the list }; /* Default constructor that creates an empty list */ DList() { header = new DNode(NULL, NULL, NULL); trailer = new DNode(NULL, header, NULL); header->next = trailer; size = 0; } //... update and search methods would go here... Linked Lists 22

23 Insertion We visualize operation insertafter(p, X), which returns position q p A B C p A B q C p X q A B X C Linked Lists 23

24 Insertion Algorithm Algorithm insertafter(p,e): Create a new node v v.setelement(e) v.setprev(p) { link v to its predecessor } v.setnext(p.getnext()) { link v to its successor } (p.getnext()).setprev(v) { link p s old successor to v } p.setnext(v) {link p to its new successor, v } return v {the position for the element e } Linked Lists 24

25 Deletion We visualize remove(p), where p == last() p A B C D A B C p D A B C Linked Lists 25

26 Deletion Algorithm Algorithm remove(p): t = p.element {temporary variable to hold the return value} (p.getprev()).setnext(p.getnext()) {linking out p} (p.getnext()).setprev(p.getprev()) Disallocate node p {invalidating the position p} return t Linked Lists 26

27 Worst-case running time In a doubly linked list + insertion at head or tail is in O(1) + deletion at either end is on O(1) -- element access is still in O(n) Linked Lists 27

Unordered Linked Lists Derive class unorderedlinkedlist from the abstract class linkedlisttype Implement the operations search, insertfirst, insertlast, deletenode See code on page 292 Defines an unordered

What is a Stack? Stacks and Queues. Stack Abstract Data Type. Java Interface for Stack ADT. Array-based Implementation

Stacks and Queues What is a Stack? Stores a set of elements in a particular order Accessed in Last-In In-First-Out (LIFO) fashion Real life examples: Pile of books PEZ dispenser Cup trays in cafeteria

STACKS,QUEUES, AND LINKED LISTS Stacks Queues Linked Lists Double-Ended Queues Case Study: A Stock Analysis Applet 1 Stacks Astack is a container of objects that are inserted and removed according to the

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

Sequential Data Structures

Sequential Data Structures In this lecture we introduce the basic data structures for storing sequences of objects. These data structures are based on arrays and linked lists, which you met in first year

Data Structures Using C++ 2E. Chapter 5 Linked Lists

Data Structures Using C++ 2E Chapter 5 Linked Lists Test #1 Next Thursday During Class Cover through (near?) end of Chapter 5 Objectives Learn about linked lists Become aware of the basic properties of

Universidad Carlos III de Madrid Algorithms and Data Structures (ADS) Bachelor in Informatics Engineering Computer Science Department Lists, Stacks and Queues. Authors: Isabel Segura Bedmar April 2011

Linked List as an ADT (cont d.) Default constructor Initializes list to an empty state Destroy the list Deallocates memory occupied by each node Initialize the list Reinitializes list to an empty state

Algorithms and Data Structures

Basic Data Structures Page 1 BFH-TI: Softwareschule Schweiz Basic Data Structures Dr. CAS SD01 Basic Data Structures Page 2 Outline Data Structures and Abstract Data Types Linear Data Structures Implementing

Data Structures Using C++ 2E. Chapter 5 Linked Lists

Data Structures Using C++ 2E Chapter 5 Linked Lists Doubly Linked Lists Traversed in either direction Typical operations Initialize the list Destroy the list Determine if list empty Search list for a given

Singly linked lists (continued...) I began the lecture by discussing two more methods that are commonly defined for linked lists, namely adding or removing an element at the back of the list. This requires

This lecture. Abstract data types Stacks Queues. ADTs, Stacks, Queues 1. 2004 Goodrich, Tamassia

This lecture Abstract data types Stacks Queues ADTs, Stacks, Queues 1 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An ADT specifies: Data stored Operations

Stacks. Stacks (and Queues) Stacks. q Stack: what is it? q ADT. q Applications. q Implementation(s) CSCU9A3 1

Stacks (and Queues) 1 Stacks Stack: what is it? ADT Applications Implementation(s) 2 CSCU9A3 1 Stacks and ueues A stack is a very important data structure in computing science. A stack is a seuence of

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 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)

Chapter 7: Queues and Deques

Chapter 7: Queues and Deques After the stack, the next simplest data abstraction is the queue. As with the stack, the queue can be visualized with many examples you are already familiar with from everyday

Outline. The Stack ADT Applications of Stacks Array-based implementation Growable array-based stack. Stacks 2

Stacks Outline The Stack ADT Applications of Stacks Array-based implementation Growable array-based stack Stacks 2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure

1 ADTs,, Arrays, Linked Lists Outline and Required Reading: ADTs ( 2.1.2) Arrays ( 1.5) Linked Lists ( 4.3.1, 4.3.2) COSC 2011, Fall 2003, Section A Instructor: N. Vlajic Abstract Data Type (ADT) 2 abstract

TIE-20106 1 TIE-20106 2

TIE-20106 1 1 List structures In this chapter, a few simple data structures (stack and queue) that can be implemented with arrays and/or lists are covered. Two more complex structures based on lists are

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

Abstract Data Types. Chapter 2

Chapter 2 Abstract Data Types The second idea at the core of computer science, along with algorithms, is data. In a modern computer, data consists fundamentally of binary bits, but meaningful data is organized

BM267 - Introduction to Data Structures

BM267 - Introduction to Data Structures 3. Elementary Data Structures Ankara University Computer Engineering Department BLM267 1 Objectives Learn about elementary data structures - Data structures that

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 STRUCTURE - STACK

DATA STRUCTURE - STACK http://www.tutorialspoint.com/data_structures_algorithms/stack_algorithm.htm Copyright tutorialspoint.com A stack is an abstract data type ADT, commonly used in most programming

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

7.1 Our Current Model

Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.

Learning Outcomes. COMP202 Complexity of Algorithms. Binary Search Trees and Other Search Trees

Learning Outcomes COMP202 Complexity of Algorithms Binary Search Trees and Other Search Trees [See relevant sections in chapters 2 and 3 in Goodrich and Tamassia.] At the conclusion of this set of lecture

Sequences in the C++ STL

CS 311 Data Structures and Algorithms Lecture Slides Wednesday, November 4, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn

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:

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

International Journal Of Engineering Research & Management Technology

International Journal Of Engineering Research & Management Technology ISSN: 2348-4039 September- 2014 Volume 1, Issue-5 Dynamic Implementation Using Linked List Karuna Department of Information and Technology

Linked Lists and Iterators Chapter 4 Click to proceed How To View This Presentation This presentation is arranged in outline format. To view the slides in proper order For each slide Read the entire slide

Algorithms and Data Structures

Algorithms and Data Structures Lists and Arrays Marcin Sydow Web Mining Lab PJWSTK Marcin Sydow (Web Mining Lab PJWSTK) Algorithms and Data Structures 1 / 35 Topics covered by this lecture: Linked Lists

Common Data Structures

Data Structures 1 Common Data Structures Arrays (single and multiple dimensional) Linked Lists Stacks Queues Trees Graphs You should already be familiar with arrays, so they will not be discussed. Trees

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

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

Linked Lists Ch 17 (Gaddis) Introduction to Linked Lists A data structure representing a A series of nodes chained together in sequence CS 3358 Summer I 2012 Jill Seaman - Each node points to one other

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

Stacks & Queues. Data structures and Algorithms

Stacks & Queues Data structures and Algorithms Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++ Goodrich, Tamassia and Mount (Wiley, 2004) Outline

SYSTEMS PROGRAMMING C++ INTRODUCTION

Faculty of Computer Science / Institute of Systems Architecture / Operating Systems SYSTEMS PROGRAMMING C++ INTRODUCTION Alexander Warg WHY C++? C++ is the language that allows to express ideas from the

Linked Lists, Stacks, Queues, Deques. It s time for a chainge!

Linked Lists, Stacks, Queues, Deques It s time for a chainge! Learning Goals After this unit, you should be able to... Differentiate an abstraction from an implementation. Define and give examples of problems

recursion, O(n), linked lists 6/14 recursion reducing the amount of data to process and processing a smaller amount of data example: process one item in a list, recursively process the rest of the list

Short Notes on Dynamic Memory Allocation, Pointer and Data Structure

Short Notes on Dynamic Memory Allocation, Pointer and Data Structure 1 Dynamic Memory Allocation in C/C++ Motivation /* a[100] vs. *b or *c */ Func(int array_size) double k, a[100], *b, *c; b = (double

- Easy to insert & delete in O(1) time - Don t need to estimate total memory needed. - Hard to search in less than O(n) time

Skip Lists CMSC 420 Linked Lists Benefits & Drawbacks Benefits: - Easy to insert & delete in O(1) time - Don t need to estimate total memory needed Drawbacks: - Hard to search in less than O(n) time (binary

Linked Lists: Implementation Sequences in the C++ STL

Linked Lists: Implementation Sequences in the C++ STL continued CS 311 Data Structures and Algorithms Lecture Slides Wednesday, April 1, 2009 Glenn G. Chappell Department of Computer Science University

UNIVERSITI MALAYSIA SARAWAK KOTA SAMARAHAN SARAWAK PSD2023 ALGORITHM & DATA STRUCTURE

STUDENT IDENTIFICATION NO UNIVERSITI MALAYSIA SARAWAK 94300 KOTA SAMARAHAN SARAWAK FAKULTI SAINS KOMPUTER & TEKNOLOGI MAKLUMAT (Faculty of Computer Science & Information Technology) Diploma in Multimedia

Data Structures and Algorithms

Data Structures and Algorithms CS245-2016S-06 Binary Search Trees David Galles Department of Computer Science University of San Francisco 06-0: Ordered List ADT Operations: Insert an element in the list

BSc (Hons) Business Information Systems, BSc (Hons) Computer Science with Network Security. & BSc. (Hons.) Software Engineering

BSc (Hons) Business Information Systems, BSc (Hons) Computer Science with Network Security & BSc. (Hons.) Software Engineering Cohort: BIS/05/FT BCNS/05/FT BSE/05/FT Examinations for 2005-2006 / Semester

Linked Lists: Implementation CS 311 Data Structures and Algorithms Lecture Slides Monday, March 30, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

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

Dynamic Memory Management

Dynamic Memory Management 1 Goals of this Lecture Help you learn about: The need for dynamic* memory management (DMM) Implementing DMM using the heap section Implementing DMM using virtual memory * During

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)

Comp 245 Data Structures. Stacks

Comp 245 Data Structures Stacks What is a Stack? A LIFO (last in, first out) structure Access (storage or retrieval) may only take place at the TOP NO random access to other elements within the stack An

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

Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Module No. # 02 Lecture No. # 05 Run-time Environments-Part 3 and Local Optimizations

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

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:

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

NIKLAUS WIRTH Algorithms + Data Structures = Programs

java04.frm Page 171 Saturday, August 26, 2000 6:03 PM 171 Linked Lists The simplest way to interrelate or link a set of elements is to line them up in a single list... For, in this case, only a single

2. Names, Scopes, and Bindings

2. Names, Scopes, and Bindings Binding, Lifetime, Static Scope, Encapsulation and Modules, Dynamic Scope Copyright 2010 by John S. Mallozzi Names Variables Bindings Binding time Language design issues

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

Data Structures Using Java

Data Structures Using Java D. S. Malik P. S. Nair THOMSON COURSE TECHNOLOGY Australia Canada Mexico Singapore Spain United Kingdom United States TABLE OF Contents PREFACE XXV 1.Software Engineering Principles

CS 230 Programming Languages

CS 230 Programming Languages 11 / 30 / 2015 Instructor: Michael Eckmann Questions/comments? Today s Topics Chapter 6 Pointers Dangling pointer problem Memory leaks Solutions Michael Eckmann - Skidmore

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

Data Structures and Data Manipulation

Data Structures and Data Manipulation What the Specification Says: Explain how static data structures may be used to implement dynamic data structures; Describe algorithms for the insertion, retrieval

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.

Organization of Programming Languages CS320/520N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Names, Bindings, and Scopes A name is a symbolic identifier used

Chapter 3: Restricted Structures Page 1

Chapter 3: Restricted Structures Page 1 1 2 3 4 5 6 7 8 9 10 Restricted Structures Chapter 3 Overview Of Restricted Structures The two most commonly used restricted structures are Stack and Queue Both

Glossary of Object Oriented Terms

Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

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

Lecture 11 Doubly Linked Lists & Array of Linked Lists In this lecture Doubly linked lists Array of Linked Lists Creating an Array of Linked Lists Representing a Sparse Matrix Defining a Node for a Sparse

ECE 250 Data Structures and Algorithms MIDTERM EXAMINATION 2008-10-23/5:15-6:45 REC-200, EVI-350, RCH-106, HH-139

ECE 250 Data Structures and Algorithms MIDTERM EXAMINATION 2008-10-23/5:15-6:45 REC-200, EVI-350, RCH-106, HH-139 Instructions: No aides. Turn off all electronic media and store them under your desk. If

Financial Management System

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING UNIVERSITY OF NEBRASKA LINCOLN Financial Management System CSCE 156 Computer Science II Project Student 002 11/15/2013 Version 3.0 The contents of this document

A linear structure is an ordered (e.g., sequenced) arrangement of elements.

Lists, Stacks, and Queues 1 A linear structure is an ordered (e.g., sequenced) arrangement of elements. There are three common types of linear structures: list stack queue random insertion and deletion

CHAPTER 4 THE PARALLEL ALGORITHM FOR DETECTION AND EXECUTION OF ARITHMETIC OPERATIONS AT INTRAINSTRUCTION LEVEL

39 CHAPTER 4 THE PARALLEL ALGORITHM FOR DETECTION AND EXECUTION OF ARITHMETIC OPERATIONS AT INTRAINSTRUCTION LEVEL In this chapter the relevant work of parallelism exploitation within a single statement

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

Collections & Data Structures. CS 3: Computer Programming in Java

Collections & Data Structures CS 3: Computer Programming in Java Objectives The concept of a collection Separating the interface from the implementation Dynamic data structures Linked lists Queues and

Data Structures Using C++ 2E. Chapter 7 Stacks

Data Structures Using C++ 2E Chapter 7 Stacks Linked Implementation of Stacks Disadvantage of array (linear) stack representation Fixed number of elements can be pushed onto stack Solution Use pointer

Class 32: The Java Collections Framework

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

Circular Linked List. Algorithms and Data Structures

Circular Linked List EENG212 Algorithms and Data Structures Circular Linked Lists In linear linked lists if a list is traversed (all the elements visited) an external pointer to the listmust be preserved

Moving from Java to C++

Moving from Java to C++ This appendix explains how to transfer your Java programming skills to a substantial subset of C++. This is necessary for students who take their first programming course in Java

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

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

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

System Software Prof. Dr. H. Mössenböck

System Software Prof. Dr. H. Mössenböck 1. Memory Management 2. Garbage Collection 3. Linkers and Loaders 4. Debuggers 5. Text Editors Marks obtained by end-term exam http://ssw.jku.at/misc/ssw/ 1. Memory

Introduction to Object-Oriented Programming

Introduction to Object-Oriented Programming Linked Lists Christopher Simpkins chris.simpkins@gatech.edu CS 1331 (Georgia Tech) Linked Lists 1 / 12 Linked Lists Dynamic data structures Singly linked lists

1. Relational database accesses data in a sequential form. (Figures 7.1, 7.2)

Chapter 7 Data Structures for Computer Graphics (This chapter was written for programmers - option in lecture course) Any computer model of an Object must comprise three different types of entities: 1.

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

Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

Lecture Notes on Binary Search Trees

Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 17 March 17, 2010 1 Introduction In the previous two lectures we have seen how to exploit the structure

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

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

Data Structures and Algorithms Stacks and Queues

Data Structures and Algorithms Stacks and Queues Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/23 6-0: Stacks and

CSE 211: Data Structures Lecture Notes VII

CSE 211: Data Structures Lecture Notes VII LINKED LISTS In the previous lectures we have seen the representation of ordered lists using an array and sequential mapping. These representations had the property

Cours de C++ Utilisations des conteneurs

Cours de C++ Utilisations des conteneurs Cécile Braunstein cecile.braunstein@lip6.fr 1 / 18 Introduction Containers - Why? Help to solve messy problems Provide useful function and data structure Consistency

COMP 356 Programming Language Structures Notes for Chapter 6 of Concepts of Programming Languages Data Types

A data type consists of: a set of values COMP 356 Programming Language Structures Notes for Chapter 6 of Concepts of Programming Languages Data Types a set of predefined operations on those values Approaches

Programming with Data Structures

Programming with Data Structures CMPSCI 187 Spring 2016 Please find a seat Try to sit close to the center (the room will be pretty full!) Turn off or silence your mobile phone Turn off your other internet-enabled