What s New in the Second Edition

Size: px
Start display at page:

Download "What s New in the Second Edition"

Transcription

1 What s New in the Second Edition This second edition of Data Structures and Algorithms in Java has been augmented to make it easier for the reader and for instructors using it as a text in computer science classes. Besides coverage of additional topics, we ve added end-of-chapter questions, experiments, and programming projects. Additional Topics We ve added a variety of interesting new topics to the book. Many provide a basis for programming projects. se new topics include Depth-first-search and game simulations Josephus problem Huffman codes for data compression Traveling Salesman problem Hamiltonian cycles Knight s Tour puzzle Floyd s algorithm Warshall s algorithm knapsack problem Listing N things taken K at a time Folding-digits hash functions radix sort End-of-Chapter Questions Short questions covering the key points of each chapter are included at the end of each chapter. answers can be found in Appendix C, Answers to Questions. se questions are intended as a self-test for readers, to ensure that they have understood the material. Experiments We include some suggested activities for the reader. se experiments often involve using the Workshop applets or example programs to examine certain features of an algorithm s operation, but some are pencil-and-paper or thought experiments. Programming Projects Most importantly, we have included at the end of each chapter a number (usually five) of challenging programming projects. y cover a range of difficulty. easiest are simple variations on the example programs. most challenging are implementations of topics discussed in the text but for which there are no example programs. Solutions to the Programming Projects are not provided in this book, but see the adjacent note..

2 What This Book Is About This book is about data structures and algorithms as used in computer programming. Data structures are ways in which data is arranged in your computer s memory (or stored on disk). Algorithms are the procedures a software program uses to manipulate the data in these structures. Almost every computer program, even a simple one, uses data structures and algorithms. For example, consider a program that prints address labels. program might use an array containing the addresses to be printed and a simple for loop to step through the array, printing each address. array in this example is a data structure, and the for loop, used for sequential access to the array, executes a simple algorithm. For uncomplicated programs with small amounts of data, such a simple approach might be all you need. However, for programs that handle even moderately large amounts of data, or which solve problems that are slightly out of the ordinary, more sophisticated techniques are necessary. Simply knowing the syntax of a computer language such as Java or C++ isn t enough. This book is about what you need to know after you ve learned a programming language. material we cover here is typically taught in colleges and universities as a second-year course in computer science, after a student has mastered the fundamentals of programming. What s Different About This Book re are dozens of books on data structures and algorithms. What s different about this one? Three things: Our primary goal in writing this book is to make the topics we cover easy to understand. Demonstration programs called Workshop applets bring to life the topics we cover, showing you step by step, with moving pictures, how data structures and algorithms work. example code is written in Java, which is easier to understand than C, C++, or Pascal, the languages traditionally used to demonstrate computer science topics. Let s look at these features in more detail. Easy to Understand Typical computer science textbooks are full of theory, mathematical formulas, and abstruse examples of computer code. This book, on the other hand, concentrates on simple explanations of techniques that can be applied to real-world problems. We avoid complex proofs and heavy math. re are lots of figures to augment the text. Many books on data structures and algorithms include considerable material on software engineering. Software engineering is a body of study concerned with designing and implementing large and complex software projects. However, it s our belief that data structures and algorithms are complicated enough without involving this additional discipline, so we have deliberately de-emphasized software engineering in this book. (We ll discuss the relationship of data structures and algorithms to software engineering in Chapter 1, Overview. ) Of course, we do use an object-oriented approach, and we discuss various aspects of object-oriented design as we go along, including a mini-tutorial on OOP in Chapter 1. Our primary emphasis, however, is on the data structures and algorithms themselves.

3 Who This Book Is For This book can be used as a text in a Data Structures and Algorithms course, typically taught in the second year of a computer science curriculum. However, it is also designed for professional programmers and for anyone else who needs to take the next step up from merely knowing a programming language. Because it s easy to understand, it is also appropriate as a supplemental text to a more formal course. What You Need to Know Before You Read This Book only prerequisite for using this book is a knowledge of some programming language. Although the example code is written in Java, you don t need to know Java to follow what s happening. Java is not hard to understand, and we ve tried to keep the syntax as general as possible, avoiding baroque or Java-specific constructions whenever possible. Of course, it won t hurt if you re already familiar with Java. Knowing C++ is essentially just as good, because Java syntax is based so closely on C++. differences are minor as they apply to our example programs (except for the welcome lamination of pointers), and we ll discuss them in Chapter 1. Software You Need to Use This Book To run the Workshop applets, you need a Web browser such as Microsoft Internet Explorer or Netscape Communicator. You can also use an applet viewer utility. Applet viewers are available with various Java development systems, including the free system from Sun Microsystems, which we ll discuss in Appendix A. To run the example programs, you can use the MS-DOS utility in Microsoft Windows (called MS-DOS Prompt) or a similar text-oriented environment. If you want to modify the source code for the example programs or write your own programs, you ll need a Java development system. Such systems are available commercially, or you can download an excellent basic system from Sun Microsystems, as described in Appendix A.

4 Contents at a Glance Introduction Overview Arrays Simple Sorting Stacks and Queues Linked Lists Recursion Advanced Sorting Binary Trees Red-Black Trees Trees and External Storage Hash Tables Heaps Graphs Weighted Graphs When to Use What Appendixes A Running the Workshop Applets and Example Programs B Further Reading C Answers to Questions Index Table of Contents Introduction 1 What s New in the Second Edition...1 Additional Topics...1 End-of-Chapter Questions...2 Experiments...2 Programming Projects...2 What This Book Is About...2 What s Different About This Book...3 Easy to Understand...3 Workshop Applets...4 Java Example Code...5 Who This Book Is For...5 What You Need to Know Before You Read This Book...5 Software You Need to Use This Book...6 How This Book Is Organized...6 Enjoy Yourself! Overview 9

5 What Are Data Structures and Algorithms Good For?...9 Real-World Data Storage...10 Programmer s Tools...11 Real-World Modeling...11 Overview of Data Structures...11 Overview of Algorithms...12 Some Definitions...13 Database...13 Record...13 Field...13 Key...14 Object-Oriented Programming...14 Problems with Procedural Languages...14 Objects in a Nutshell...15 A Runnable Object-Oriented Program...18 Inheritance and Polymorphism...21 Software Engineering...21 Java for C++ Programmers...22 No Pointers...22 Overloaded Operators...25 Primitive Variable Types...25 Input/Output...26 Java Library Data Structures...29 Summary...30 Questions A rrays 33 Array Workshop Applet...33 Insertion...35 Searching...36 Deletion...36 Duplicates Issue...37 Not Too Swift...39 Basics of Arrays in Java...39 Creating an Array...40 Accessing Array Elements...40 Initialization...41 An Array Example...41 Dividing a Program into Classes...44 Classes LowArray and LowArray App...46 Class Interfaces...46 Not So Convenient...47 Who s Responsible for What?...48 higharray.java

6 Example...48 User s Life Made Easier...52 Abstraction...52 Ordered Workshop Applet...52 Linear Search...53 Binary Search...54 Java Code for an Ordered Array...56 Binary Search with the find() Method...56 OrdArray Class...58 Advantages of Ordered Arrays...61 Logarithms...62 Equation...63 Opposite of Raising Two to a Power...64 Storing Objects...64 Person Class...65 classdataarray.java Program...65 Big O Notation...70 Insertion in an Unordered Array: Constant...70 Linear Search: Proportional to N...70 Binary Search: Proportional to log(n)...71 Don t Need the Constant...71 Why Not Use Arrays for Everything?...72 Summary...73 Questions...74 Experiments...75 Programming Projects S imple Sorting 77 How Would You Do It?...78 Bubble Sort...79 Bubble Sort on the Baseball Players...79 BubbleSort Workshop Applet...81 Java Code for a Bubble Sort...85 Invariants...88 Efficiency of the Bubble Sort...88 Selection Sort...89 Selection Sort on the Baseball Players...89 SelectSort Workshop Applet...90 Java Code for Selection Sort...92 Invariant...95

7 Efficiency of the Selection Sort...95 Insertion Sort...95 Insertion Sort on the Baseball Players...95 InsertSort Workshop Applet...97 Java Code for Insertion Sort...99 Invariants in the Insertion Sort Efficiency of the Insertion Sort Sorting Objects Java Code for Sorting Objects Lexicographical Comparisons Stability Comparing the Simple Sorts Summary Questions Experiments Programming Projects Stacks and Queues 115 A Different Kind of Structure Programmer s Tools Restricted Access More Abstract Stacks Postal Analogy Stack Workshop Applet Java Code for a Stack Stack Example 1: Reversing a Word Stack Example 2: Delimiter Matching Efficiency of Stacks Queues Queue Workshop Applet A Circular Queue Java Code for a Queue Efficiency of Queues Deques Priority Queues PriorityQ Workshop Applet Java Code for a Priority Queue Efficiency of Priority Queues Parsing Arithmetic Expressions Postfix Notation Translating Infix to Postfix Evaluating Postfix Expressions Summary Questions Experiments Programming Projects L

8 inked Lists 179 Links References and Basic Types Relationship, Not Position LinkList Workshop Applet Insert Button Find Button Delete Button A Simple Linked List Link Class LinkList Class insertfirst() Method deletefirst() Method displaylist() Method linklist.java Program Finding and Deleting Specified Links find() Method delete() Method Other Methods Double-Ended Lists Linked-List Efficiency Abstract Data Types A Stack Implemented by a Linked List A Queue Implemented by a Linked List Data Types and Abstraction ADT Lists ADTs as a Design Tool Sorted Lists Java Code to Insert an Item in a Sorted List sortedlist.java Program Efficiency of Sorted Linked Lists...218

9 List Insertion Sort Doubly Linked Lists Traversal Insertion Deletion doublylinked.java Program Doubly Linked List as Basis for Deques Iterators A Reference in the List Itself? An Iterator Class Additional Iterator Features Iterator Methods interiterator.java Program Where Does the Iterator Point? atend() Method Iterative Operations Other Methods Summary Questions Experiments Programming Projects Recursion 251 Triangular Numbers Finding the n th Term Using a Loop Finding the n th Term Using Recursion triangle.java Program What s Really Happening? Characteristics of Recursive Methods Is Recursion Efficient? Mathematical Induction Factorials Anagrams A Recursive Binary Search Recursion Replaces the Loop Divide-and-Conquer Algorithms Towers of Hanoi...273

10 Towers Workshop Applet Moving Subtrees Recursive Algorithm towers.java Program mergesort Merging Two Sorted Arrays Sorting by Merging MergeSort Workshop Applet mergesort.java Program Efficiency of the mergesort Eliminating Recursion Recursion and Stacks Simulating a Recursive Method What Does This Prove? Some Interesting Recursive Applications Raising a Number to a Power Knapsack Problem Combinations: Picking a Team Summary Questions Experiments Programming Projects A dvanced Sorting 315 Shellsort Insertion Sort: Too Many Copies N-Sorting Diminishing Gaps Shellsort Workshop Applet Java Code for the Shellsort Other Interval Sequences Efficiency of the Shellsort Partitioning Partition Workshop Applet partition.java Program Partition Algorithm Efficiency of the Partition Algorithm Quicksort Quicksort Algorithm Choosing a Pivot Value QuickSort1 Workshop Applet Degenerates to O(N2) Performance...344

11 Median-of-Three Partitioning Handling Small Partitions Removing Recursion Efficiency of Quicksort Radix Sort Algorithm for the Radix Sort Designing a Program Efficiency of the Radix Sort Summary Questions Experiments Programming Projects Binary Trees 365 Why Use Binary Trees? Slow Insertion in an Ordered Array Slow Searching in a Linked List Trees to the Rescue What Is a Tree? Tree Terminology Path Root Parent Child Leaf Subtree Visiting Traversing Levels Keys Binary Trees An Analogy How Do Binary Search Trees Work? Binary Tree Workshop Applet Representing the Tree in Java Code Finding a Node Using the Workshop Applet to Find a Node Java Code for Finding a Node Tree Efficiency Inserting a Node Using the Workshop Applet to Insert a Node Java Code for Inserting a Node Traversing the Tree Inorder Traversal Java Code for Traversing Traversing a Three-Node Tree Traversing with the Workshop Applet Preorder and Postorder Traversals...385

12 Finding Maximum and Minimum Values Deleting a Node Case 1: Node to Be Deleted Has No Children Case 2: Node to Be Deleted Has One Child Case 3: Node to Be Deleted Has Two Children Efficiency of Binary Trees Trees Represented as Arrays Duplicate Keys Complete tree.java Program Huffman Code Character Codes Decoding with the Huffman Tree Creating the Huffman Tree Coding the Message Creating the Huffman Code Summary Questions Experiments Programming Projects Red-Black Trees 429 Our Approach to the Discussion Conceptual Top-Down Insertion Balanced and Unbalanced Trees Degenerates to O(N) Balance to the Rescue Red-Black Tree Characteristics Fixing Rule Violations Using the RBTree Workshop Applet Clicking on a Node Start Button Ins Button Del Button Flip Button RoL Button RoR Button R/B Button Text Messages Where s the Find Button? Experimenting with the Workshop Applet Experiment 1: Inserting Two Red Nodes Experiment 2: Rotations Experiment 3: Color Flips Experiment 4: An Unbalanced Tree More Experiments...440

13 Red-Black Rules and Balanced Trees Null Children Rotations Simple Rotations Weird Crossover Node Subtrees on the Move Human Beings Versus Computers Inserting a New Node Preview of the Insertion Process Color Flips on the Way Down Rotations After the Node Is Inserted Rotations on the Way Down Deletion Efficiency of Red-Black Trees Red-Black Tree Implementation Other Balanced Trees Summary Questions Experiments Trees and External Storage 463 Introduction to Trees What s in a Name? Tree Organization Searching a Tree Insertion Node Splits Splitting the Root Splitting on the Way Down Tree234 Workshop Applet Fill Button Find Button Ins Button Zoom Button Viewing Different Nodes Experiments Java Code for a Tree DataItem Class Node Class Tree234 Class...476

14 Tree234App Class Complete tree234.java Program Trees and Red-Black Trees Transformation from to Red-Black Operational Equivalence Efficiency of Trees Speed Storage Requirements Trees Node Splits Implementation External Storage Accessing External Data Sequential Ordering B-Trees Indexing Complex Search Criteria Sorting External Files Summary Questions Experiments Programming Projects Hash Tables 519 Introduction to Hashing Employee Numbers as Keys A Dictionary Hashing Collisions Open Addressing Linear Probing Java Code for a Linear Probe Hash Table Quadratic Probing Double Hashing Separate Chaining HashChain Workshop Applet Java Code for Separate Chaining Hash Functions Quick Computation Random Keys Non-Random Keys Hashing Strings Folding Hashing Efficiency Open Addressing...566

15 Separate Chaining Open Addressing Versus Separate Chaining Hashing and External Storage Table of File Pointers Non-Full Blocks Full Blocks Summary Questions Experiments Programming Projects Heaps 579 Introduction to Heaps Priority Queues, Heaps, and ADTs Weakly Ordered Removal Insertion Not Really Swapped Heap Workshop Applet Fill Button Change Button Remove Button Insert Button Java Code for Heaps Insertion Removal Key Change Array Size heap.java Program Expanding the Heap Array Efficiency of Heap Operations A Tree-based Heap Heapsort Trickling Down in Place Using the Same Array heapsort.java Program Efficiency of Heapsort Summary Questions Experiments Programming Projects Graphs 615 Introduction to Graphs Definitions...616

16 Historical Note Representing a Graph in a Program Adding Vertices and Edges to a Graph Graph Class Searches Depth-First Search Breadth-First Search Minimum Spanning Trees GraphN Workshop Applet Java Code for the Minimum Spanning Tree mst.java Program Topological Sorting with Directed Graphs An Example: Course Prerequisites Directed Graphs Topological Sorting GraphD Workshop Applet Cycles and Trees Java Code Connectivity in Directed Graphs Connectivity Table Warshall s Algorithm Implementation of Warshall s Algorithm Summary Questions Experiments Programming Projects Weighted Graphs 669 Minimum Spanning Tree with Weighted Graphs An Example: Cable TV in the Jungle GraphW Workshop Applet Send Out the Surveyors Creating the Algorithm Java Code mstw.java Program Shortest-Path Problem Railroad Line Dijkstra s Algorithm Agents and Train Rides Using the GraphDW Workshop Applet Java Code...698

17 path.java Program All-Pairs Shortest-Path Problem Efficiency Intractable Problems Knight s Tour Traveling Salesman Problem Hamiltonian Cycles Summary Questions Experiments Programming Projects When to Use What 717 General-Purpose Data Structures Speed and Algorithms Libraries Arrays Linked Lists Binary Search Trees Balanced Trees Hash Tables Comparing the General-Purpose Storage Structures Special-Purpose Data Structures Stack Queue Priority Queue Comparison of Special-Purpose Structures Sorting Graphs External Storage Sequential Storage Indexed Files B-trees Hashing Virtual Memory Onward Appendixes A Running the Workshop Applets and Example Programs 729 Workshop Applets Example Programs Sun Microsystem s Software Development Kit Command-line Programs Setting the Path Viewing the Workshop Applets Operating the Workshop Applets...732

18 Running the Example Programs Compiling the Example Programs Editing the Source Code Terminating the Example Programs Multiple Class Files Other Development Systems B Further Reading 735 Data Structures and Algorithms Object-Oriented Programming Languages Object-Oriented Design (OOD) and Software Engineering C Answers to Questions 739 Chapter 1, Overview Answers to Questions Chapter 2, Arrays Answers to Questions Chapter 3, Simple Sorting Answers to Questions Chapter 4, Stacks and Queues Answers to Questions Chapter 5, Linked Lists Answers to Questions Chapter 6, Recursion Answers to Questions Chapter 7, Advanced Sorting Answers to Questions Chapter 8, Binary Trees Answers to Questions Chapter 9, Red-Black Trees Answers to Questions Chapter 10, Trees and External Storage Answers to Questions Chapter 11, Hash Tables Answers to Questions Chapter 12, Heaps Answers to Questions Chapter 13, Graphs Answers to Questions Chapter 14, Weighted Graphs Answers to Questions...747

Table of Contents. Chapter 1: Introduction to Data Structures... 1

Table of Contents. Chapter 1: Introduction to Data Structures... 1 Table of Contents Chapter 1: Introduction to Data Structures... 1 1.1 Data Types in C++... 2 Integer Types... 2 Character Types... 3 Floating-point Types... 3 Variables Names... 4 1.2 Arrays... 4 Extraction

More information

CS301 - Data Structures Glossary By

CS301 - Data Structures Glossary By CS301 - Data Structures Glossary By Abstract Data Type : A set of data values and associated operations that are precisely specified independent of any particular implementation. Also known as ADT Algorithm

More information

Course Name: B.Tech. 3 th Sem. No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours. Planned.

Course Name: B.Tech. 3 th Sem. No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours. Planned. Course Name: B.Tech. 3 th Sem. Subject: Data Structures No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours Paper Code: ETCS-209 Topic Details No of Hours Planned

More information

Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis

Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis p. 5 Statement Constructs p. 5 Pseudocode Example p.

More information

AP Computer Science 4325

AP Computer Science 4325 4325 Instructional Unit Algorithm Design Techniques -divide-and-conquer The students will be -Decide whether an algorithm -classroom discussion -backtracking able to classify uses divide-and-conquer, -worksheets

More information

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC)

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC) SET - 1 II B. Tech I Semester Supplementary Examinations, May/June - 2016 PART A 1. a) Write a procedure for the Tower of Hanoi problem? b) What you mean by enqueue and dequeue operations in a queue? c)

More information

Department of Computer Science and Technology

Department of Computer Science and Technology UNIT : Stack & Queue Short Questions 1 1 1 1 1 1 1 1 20) 2 What is the difference between Data and Information? Define Data, Information, and Data Structure. List the primitive data structure. List the

More information

& ( D. " mnp ' ( ) n 3. n 2. ( ) C. " n

& ( D.  mnp ' ( ) n 3. n 2. ( ) C.  n CSE Name Test Summer Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n " n matrices is: A. " n C. "% n B. " max( m,n, p). The

More information

Data Structures and Algorithm Analysis in C++

Data Structures and Algorithm Analysis in C++ INTERNATIONAL EDITION Data Structures and Algorithm Analysis in C++ FOURTH EDITION Mark A. Weiss Data Structures and Algorithm Analysis in C++, International Edition Table of Contents Cover Title Contents

More information

) $ f ( n) " %( g( n)

) $ f ( n)  %( g( n) CSE 0 Name Test Spring 008 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to compute the sum of the n elements of an integer array is: # A.

More information

( ). Which of ( ) ( ) " #& ( ) " # g( n) ( ) " # f ( n) Test 1

( ). Which of ( ) ( )  #& ( )  # g( n) ( )  # f ( n) Test 1 CSE 0 Name Test Summer 006 Last Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n x n matrices is: A. "( n) B. "( nlogn) # C.

More information

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May www.jwjobs.net R10 SET - 1 II B. Tech I Semester, Supplementary Examinations, May - 2012 (Com. to CSE, IT, ECC ) Time: 3 hours Max Marks: 75 *******-****** 1. a) Which of the given options provides the

More information

9. The expected time for insertion sort for n keys is in which set? (All n! input permutations are equally likely.)

9. The expected time for insertion sort for n keys is in which set? (All n! input permutations are equally likely.) CSE 0 Name Test Spring 006 Last 4 Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. Suppose f ( x) is a monotonically increasing function. Which of the

More information

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8)

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8) B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2009 EC 2202 DATA STRUCTURES AND OBJECT ORIENTED Time: Three hours PROGRAMMING IN C++ Answer ALL questions Maximum: 100 Marks 1. When do we declare a

More information

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n)

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n) CSE 0 Test Your name as it appears on your UTA ID Card Fall 0 Multiple Choice:. Write the letter of your answer on the line ) to the LEFT of each problem.. CIRCLED ANSWERS DO NOT COUNT.. points each. The

More information

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D.

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D. CSE 0 Name Test Fall 00 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to convert an array, with priorities stored at subscripts through n,

More information

CLASSIC DATA STRUCTURES IN JAVA

CLASSIC DATA STRUCTURES IN JAVA CLASSIC DATA STRUCTURES IN JAVA Timothy Budd Oregon State University Boston San Francisco New York London Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Paris Cape Town Hong Kong Montreal CONTENTS

More information

( ) + n. ( ) = n "1) + n. ( ) = T n 2. ( ) = 2T n 2. ( ) = T( n 2 ) +1

( ) + n. ( ) = n 1) + n. ( ) = T n 2. ( ) = 2T n 2. ( ) = T( n 2 ) +1 CSE 0 Name Test Summer 00 Last Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. Suppose you are sorting millions of keys that consist of three decimal

More information

CS8391-DATA STRUCTURES QUESTION BANK UNIT I

CS8391-DATA STRUCTURES QUESTION BANK UNIT I CS8391-DATA STRUCTURES QUESTION BANK UNIT I 2MARKS 1.Define data structure. The data structure can be defined as the collection of elements and all the possible operations which are required for those

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name Course Code Class Branch DATA STRUCTURES ACS002 B. Tech

More information

ASSIGNMENTS. Progra m Outcom e. Chapter Q. No. Outcom e (CO) I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n))

ASSIGNMENTS. Progra m Outcom e. Chapter Q. No. Outcom e (CO) I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n)) ASSIGNMENTS Chapter Q. No. Questions Course Outcom e (CO) Progra m Outcom e I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n)) 2 3. What is the time complexity of the algorithm? 4

More information

Data Structures and Abstractions with Java

Data Structures and Abstractions with Java Global edition Data Structures and Abstractions with Java Fourth edition Frank M. Carrano Timothy M. Henry Data Structures and Abstractions with Java TM Fourth Edition Global Edition Frank M. Carrano University

More information

Data Structures Question Bank Multiple Choice

Data Structures Question Bank Multiple Choice Section 1. Fundamentals: Complexity, Algorthm Analysis 1. An algorithm solves A single problem or function Multiple problems or functions Has a single programming language implementation 2. A solution

More information

Course Review for Finals. Cpt S 223 Fall 2008

Course Review for Finals. Cpt S 223 Fall 2008 Course Review for Finals Cpt S 223 Fall 2008 1 Course Overview Introduction to advanced data structures Algorithmic asymptotic analysis Programming data structures Program design based on performance i.e.,

More information

Data Structures in C++ Using the Standard Template Library

Data Structures in C++ Using the Standard Template Library Data Structures in C++ Using the Standard Template Library Timothy Budd Oregon State University ^ ADDISON-WESLEY An imprint of Addison Wesley Longman, Inc. Reading, Massachusetts Harlow, England Menlo

More information

( ) D. Θ ( ) ( ) Ο f ( n) ( ) Ω. C. T n C. Θ. B. n logn Ο

( ) D. Θ ( ) ( ) Ο f ( n) ( ) Ω. C. T n C. Θ. B. n logn Ο CSE 0 Name Test Fall 0 Multiple Choice. Write your answer to the LEFT of each problem. points each. The expected time for insertion sort for n keys is in which set? (All n! input permutations are equally

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

Chapter 1 Introduction

Chapter 1 Introduction Preface xv Chapter 1 Introduction 1.1 What's the Book About? 1 1.2 Mathematics Review 2 1.2.1 Exponents 3 1.2.2 Logarithms 3 1.2.3 Series 4 1.2.4 Modular Arithmetic 5 1.2.5 The P Word 6 1.3 A Brief Introduction

More information

CS 445: Data Structures Final Examination: Study Guide

CS 445: Data Structures Final Examination: Study Guide CS 445: Data Structures Final Examination: Study Guide Java prerequisites Classes, objects, and references Access modifiers Arguments and parameters Garbage collection Self-test questions: Appendix C Designing

More information

DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA

DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA WALLS AND MIRRORS First Edition Frank M. Carrano University of Rhode Island Janet J. Prichard Bryant College Boston San Francisco New York London Toronto

More information

Trees! Ellen Walker! CPSC 201 Data Structures! Hiram College!

Trees! Ellen Walker! CPSC 201 Data Structures! Hiram College! Trees! Ellen Walker! CPSC 201 Data Structures! Hiram College! ADTʼs Weʼve Studied! Position-oriented ADT! List! Stack! Queue! Value-oriented ADT! Sorted list! All of these are linear! One previous item;

More information

( ) n 3. n 2 ( ) D. Ο

( ) n 3. n 2 ( ) D. Ο CSE 0 Name Test Summer 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n n matrices is: A. Θ( n) B. Θ( max( m,n, p) ) C.

More information

Multiple Choice. Write your answer to the LEFT of each problem. 3 points each

Multiple Choice. Write your answer to the LEFT of each problem. 3 points each CSE 0-00 Test Spring 0 Name Last 4 Digits of Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. Suppose f ( x) is a monotonically increasing function. Which of the

More information

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs Computational Optimization ISE 407 Lecture 16 Dr. Ted Ralphs ISE 407 Lecture 16 1 References for Today s Lecture Required reading Sections 6.5-6.7 References CLRS Chapter 22 R. Sedgewick, Algorithms in

More information

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 The data of the problem is of 2GB and the hard disk is of 1GB capacity, to solve this problem we should Use better data structures

More information

DATA STRUCTURES AND PROBLEM SOLVING USING JAVA

DATA STRUCTURES AND PROBLEM SOLVING USING JAVA DATA STRUCTURES AND PROBLEM SOLVING USING JAVA Second Edition MARK ALLEN WEISS Florida International University Addison Wesley Boston San Francisco New York London Toronto Sydney Tokyo Singapore Madrid

More information

( ) ( ) C. " 1 n. ( ) $ f n. ( ) B. " log( n! ) ( ) and that you already know ( ) ( ) " % g( n) ( ) " #&

( ) ( ) C.  1 n. ( ) $ f n. ( ) B.  log( n! ) ( ) and that you already know ( ) ( )  % g( n) ( )  #& CSE 0 Name Test Summer 008 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time for the following code is in which set? for (i=0; i

More information

Course goals. exposure to another language. knowledge of specific data structures. impact of DS design & implementation on program performance

Course goals. exposure to another language. knowledge of specific data structures. impact of DS design & implementation on program performance Course goals exposure to another language C++ Object-oriented principles knowledge of specific data structures lists, stacks & queues, priority queues, dynamic dictionaries, graphs impact of DS design

More information

List of Transparencies

List of Transparencies List of Transparencies Chapter 1 Primitive Java 1 A simple first program 2 The eight primitve types in Java 3 Program that illustrates operators 4 Result of logical operators 5 Examples of conditional

More information

CS 8391 DATA STRUCTURES

CS 8391 DATA STRUCTURES DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK CS 8391 DATA STRUCTURES UNIT- I PART A 1. Define: data structure. A data structure is a way of storing and organizing data in the memory for

More information

CS8391-DATA STRUCTURES

CS8391-DATA STRUCTURES ST.JOSEPH COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERI NG CS8391-DATA STRUCTURES QUESTION BANK UNIT I 2MARKS 1.Explain the term data structure. The data structure can be defined

More information

Binary Trees

Binary Trees Binary Trees 4-7-2005 Opening Discussion What did we talk about last class? Do you have any code to show? Do you have any questions about the assignment? What is a Tree? You are all familiar with what

More information

Test 1 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 2 points each t 1

Test 1 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 2 points each t 1 CSE 0 Name Test Fall 00 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each t. What is the value of k? k=0 A. k B. t C. t+ D. t+ +. Suppose that you have

More information

( D. Θ n. ( ) f n ( ) D. Ο%

( D. Θ n. ( ) f n ( ) D. Ο% CSE 0 Name Test Spring 0 Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to run the code below is in: for i=n; i>=; i--) for j=; j

More information

Lecture 7. Transform-and-Conquer

Lecture 7. Transform-and-Conquer Lecture 7 Transform-and-Conquer 6-1 Transform and Conquer This group of techniques solves a problem by a transformation to a simpler/more convenient instance of the same problem (instance simplification)

More information

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu.

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu. 17CA 104DATA STRUCTURES Academic Year : 018-019 Programme : MCA Year / Semester : I / I Question Bank Course Coordinator: Mrs. C.Mallika Course Objectives The student should be able to 1. To understand

More information

Course Review. Cpt S 223 Fall 2009

Course Review. Cpt S 223 Fall 2009 Course Review Cpt S 223 Fall 2009 1 Final Exam When: Tuesday (12/15) 8-10am Where: in class Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes Homeworks & program

More information

Algorithm Class. C C++ DS JAVA DATA STRUCTURES TRAINING INSTITUTE KPHB HYDERABAD. Mobile:

Algorithm Class.   C C++ DS JAVA DATA STRUCTURES TRAINING INSTITUTE KPHB HYDERABAD. Mobile: C C++ DS JAVA DATA STRUCTURES TRAINING INSTITUTE KPHB HYDERABAD Algorithm Class Mobile: +91-9963930865 https://sites.google.com/site/algorithmclass Data Structures for interviews Course details By Algorithm

More information

Course Review. Cpt S 223 Fall 2010

Course Review. Cpt S 223 Fall 2010 Course Review Cpt S 223 Fall 2010 1 Final Exam When: Thursday (12/16) 8-10am Where: in class Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes Homeworks & program

More information

Draw a diagram of an empty circular queue and describe it to the reader.

Draw a diagram of an empty circular queue and describe it to the reader. 1020_1030_testquestions.text Wed Sep 10 10:40:46 2014 1 1983/84 COSC1020/30 Tests >>> The following was given to students. >>> Students can have a good idea of test questions by examining and trying the

More information

Algorithms: Design & Practice

Algorithms: Design & Practice Algorithms: Design & Practice Deepak Kumar Bryn Mawr College Spring 2018 Course Essentials Algorithms Design & Practice How to design Learn some good ones How to implement practical considerations How

More information

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid. Fall 2018

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid. Fall 2018 CSCE 20/220 Data Structures and Algorithms Prof. Amr Goneid Fall 208 CSCE 20/220 DATA STRUCTURES AND ALGORITHMS Dr. Amr Goneid Course Goals To introduce concepts of Data Models, Data Abstraction and ADTs

More information

School of Computing and Information Sciences. Course Title: Data Structures Date: 3/30/2010 Course Number: COP 3530 Number of Credits: 3

School of Computing and Information Sciences. Course Title: Data Structures Date: 3/30/2010 Course Number: COP 3530 Number of Credits: 3 Course Title: Date: 3/30/2010 Course Number: Number of Credits: 3 Subject Area: Programming Subject Area Coordinator: Tim Downey email: downeyt@cis.fiu.edu Catalog Description: Basic concepts of data organization,

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

CS302 Data Structures using C++

CS302 Data Structures using C++ CS302 Data Structures using C++ Study Guide for the Final Exam Fall 2018 Revision 1.1 This document serves to help you prepare towards the final exam for the Fall 2018 semester. 1. What topics are to be

More information

n 2 ( ) ( ) + n is in Θ n logn

n 2 ( ) ( ) + n is in Θ n logn CSE Test Spring Name Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply an m n matrix and a n p matrix is in: A. Θ( n) B. Θ( max(

More information

Computer Science E-22 Practice Final Exam

Computer Science E-22 Practice Final Exam name Computer Science E-22 This exam consists of three parts. Part I has 10 multiple-choice questions that you must complete. Part II consists of 4 multi-part problems, of which you must complete 3, and

More information

DATA STRUCTURES THROUGH C++

DATA STRUCTURES THROUGH C++ II Year I Semester DATA STRUCTURES THROUGH C++ L T P C 4 0 0 3 OBJECTIVES: To be familiar with basic techniques of object oriented principles and exception handling using C++ To be familiar with the concepts

More information

End-Term Examination Second Semester [MCA] MAY-JUNE 2006

End-Term Examination Second Semester [MCA] MAY-JUNE 2006 (Please write your Roll No. immediately) Roll No. Paper Code: MCA-102 End-Term Examination Second Semester [MCA] MAY-JUNE 2006 Subject: Data Structure Time: 3 Hours Maximum Marks: 60 Note: Question 1.

More information

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May Code No: R21051 R10 SET - 1 II B. Tech I Semester, Supplementary Examinations, May - 2012 DATA STRUCTURES (Com. to CSE, IT, ECC ) Time: 3 hours Max Marks: 75 Answer any FIVE Questions All Questions carry

More information

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 1

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 1 QUESTION BANK ON COURSE: 304: PRELIMINARIES: 1. What is array of pointer, explain with appropriate example? 2 2. Differentiate between call by value and call by reference, give example. 3. Explain pointer

More information

Virtual University of Pakistan

Virtual University of Pakistan Virtual University of Pakistan Department of Computer Science Course Outline Course Instructor Dr. Sohail Aslam E mail Course Code Course Title Credit Hours 3 Prerequisites Objectives Learning Outcomes

More information

n 2 C. Θ n ( ) Ο f ( n) B. n 2 Ω( n logn)

n 2 C. Θ n ( ) Ο f ( n) B. n 2 Ω( n logn) CSE 0 Name Test Fall 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to find the maximum of the n elements of an integer array is in: A.

More information

Acknowledgments I INTRODUCTION 1

Acknowledgments I INTRODUCTION 1 Preface This handbook of data structures and algorithms is designed as a comprehensive resource for computer science students and practitioners. The book is, quite literally, the product of a marriage

More information

n 2 ( ) ( ) Ο f ( n) ( ) Ω B. n logn Ο

n 2 ( ) ( ) Ο f ( n) ( ) Ω B. n logn Ο CSE 220 Name Test Fall 20 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 4 points each. The time to compute the sum of the n elements of an integer array is in:

More information

Advanced Tree Data Structures

Advanced Tree Data Structures Advanced Tree Data Structures Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park Binary trees Traversal order Balance Rotation Multi-way trees Search Insert Overview

More information

Final Examination CSE 100 UCSD (Practice)

Final Examination CSE 100 UCSD (Practice) Final Examination UCSD (Practice) RULES: 1. Don t start the exam until the instructor says to. 2. This is a closed-book, closed-notes, no-calculator exam. Don t refer to any materials other than the exam

More information

LECTURE 3 ALGORITHM DESIGN PARADIGMS

LECTURE 3 ALGORITHM DESIGN PARADIGMS LECTURE 3 ALGORITHM DESIGN PARADIGMS Introduction Algorithm Design Paradigms: General approaches to the construction of efficient solutions to problems. Such methods are of interest because: They provide

More information

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers?

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers? Review for Final (Chapter 6 13, 15) 6. Template functions & classes 1) What is the primary purpose of template functions? A. To allow a single function to be used with varying types of arguments B. To

More information

Computer Science 302 Spring 2017 (Practice for) Final Examination, May 10, 2017

Computer Science 302 Spring 2017 (Practice for) Final Examination, May 10, 2017 Computer Science 302 Spring 2017 (Practice for) Final Examination, May 10, 2017 Name: The entire practice examination is 1005 points. 1. True or False. [5 points each] The time to heapsort an array of

More information

( ) 1 B. 1. Suppose f x

( ) 1 B. 1. Suppose f x CSE Name Test Spring Last Digits of Student ID Multiple Choice. Write your answer to the LEFT of each problem. points each is a monotonically increasing function. Which of the following approximates the

More information

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid CSCE 20/220 Data Structures and Algorithms Prof. Amr Goneid Fall 208 / Spring 209 CSCE 20/220 DATA STRUCTURES AND ALGORITHMS Prof. Amr Goneid Instructor: Prof. Amr Goneid E-mail: goneid@aucegypt.edu Office:

More information

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass Marks: 24

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass Marks: 24 Prepared By ASCOL CSIT 2070 Batch Institute of Science and Technology 2065 Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass

More information

Operations on Heap Tree The major operations required to be performed on a heap tree are Insertion, Deletion, and Merging.

Operations on Heap Tree The major operations required to be performed on a heap tree are Insertion, Deletion, and Merging. Priority Queue, Heap and Heap Sort In this time, we will study Priority queue, heap and heap sort. Heap is a data structure, which permits one to insert elements into a set and also to find the largest

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 COMPUTER SCIENCE AND ENGINEERING COURSE DESCRIPTION FORM Course Title Course Code Regulation Course Structure Course Coordinator

More information

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \ BSc IT C Programming (2013-2017) Unit I Q1. What do you understand by type conversion? (2013) Q2. Why we need different data types? (2013) Q3 What is the output of the following (2013) main() Printf( %d,

More information

Algorithms in Systems Engineering ISE 172. Lecture 16. Dr. Ted Ralphs

Algorithms in Systems Engineering ISE 172. Lecture 16. Dr. Ted Ralphs Algorithms in Systems Engineering ISE 172 Lecture 16 Dr. Ted Ralphs ISE 172 Lecture 16 1 References for Today s Lecture Required reading Sections 6.5-6.7 References CLRS Chapter 22 R. Sedgewick, Algorithms

More information

Syllabus for Bachelor of Technology. Computer Engineering. Subject Code: 01CE0301. Subject Name: Data Structure. B.Tech. Year - II

Syllabus for Bachelor of Technology. Computer Engineering. Subject Code: 01CE0301. Subject Name: Data Structure. B.Tech. Year - II Subject Code: 01CE0301 Subject Name: Data Structure B.Tech. Year - II Objective: Data structure has high importance in the field of Computer & IT. Organization of data is crucial for implementation and

More information

COURSE: DATA STRUCTURES USING C & C++ CODE: 05BMCAR17161 CREDITS: 05

COURSE: DATA STRUCTURES USING C & C++ CODE: 05BMCAR17161 CREDITS: 05 COURSE: DATA STRUCTURES USING C & C++ CODE: 05BMCAR17161 CREDITS: 05 Unit 1 : LINEAR DATA STRUCTURES Introduction - Abstract Data Types (ADT), Arrays and its representation Structures, Stack, Queue, Circular

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name : DATA STRUCTURES Course Code : A30502 Class : II B.

More information

WITH C+ + William Ford University of the Pacific. William Topp University of the Pacific. Prentice Hall, Englewood Cliffs, New Jersey 07632

WITH C+ + William Ford University of the Pacific. William Topp University of the Pacific. Prentice Hall, Englewood Cliffs, New Jersey 07632 DATA STRUCTURES WITH C+ + William Ford University of the Pacific William Topp University of the Pacific Prentice Hall, Englewood Cliffs, New Jersey 07632 CONTENTS Preface xvii CHAPTER 1 INTRODUCTION 1

More information

Cpt S 223 Fall Cpt S 223. School of EECS, WSU

Cpt S 223 Fall Cpt S 223. School of EECS, WSU Course Review Cpt S 223 Fall 2012 1 Final Exam When: Monday (December 10) 8 10 AM Where: in class (Sloan 150) Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes

More information

CS 270 Algorithms. Oliver Kullmann. Binary search. Lists. Background: Pointers. Trees. Implementing rooted trees. Tutorial

CS 270 Algorithms. Oliver Kullmann. Binary search. Lists. Background: Pointers. Trees. Implementing rooted trees. Tutorial Week 7 General remarks Arrays, lists, pointers and 1 2 3 We conclude elementary data structures by discussing and implementing arrays, lists, and trees. Background information on pointers is provided (for

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

Home Works and Assignments

Home Works and Assignments Course Title: Course Code: Credit Hours Theory: Credit Hours Lab (If Applicable): Instructor Name with Qualification: Course Objectives: Course Learning Outcomes: Contents (Catalog Description): Recommended

More information

Summer Final Exam Review Session August 5, 2009

Summer Final Exam Review Session August 5, 2009 15-111 Summer 2 2009 Final Exam Review Session August 5, 2009 Exam Notes The exam is from 10:30 to 1:30 PM in Wean Hall 5419A. The exam will be primarily conceptual. The major emphasis is on understanding

More information

Tribhuvan University Institute of Science and Technology Computer Science and Information Technology (CSC. 154) Section A Attempt any Two questions:

Tribhuvan University Institute of Science and Technology Computer Science and Information Technology (CSC. 154) Section A Attempt any Two questions: Tribhuvan University 2065 Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSC. 154) Pass Marks: 24 (Data Structure and Algorithm) Time:

More information

Data Structures and Algorithms Notes

Data Structures and Algorithms Notes Data Structures and Algorithms Notes Notes by Winst Course taught by Dr. G. R. Baliga 256-400 ext. 3890 baliga@rowan.edu Course started: September 4, 2012 Last generated: December 18, 2013 Interfaces -

More information

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer) COSC 2007 Data Structures II Final Exam Thursday, April 13 th, 2006 This is a closed book and closed notes exam. There are total 3 parts. Please answer the questions in the provided space and use back

More information

CSC Design and Analysis of Algorithms

CSC Design and Analysis of Algorithms CSC : Lecture 7 CSC - Design and Analysis of Algorithms Lecture 7 Transform and Conquer I Algorithm Design Technique CSC : Lecture 7 Transform and Conquer This group of techniques solves a problem by a

More information

CSE 332: Data Structures & Parallelism Lecture 12: Comparison Sorting. Ruth Anderson Winter 2019

CSE 332: Data Structures & Parallelism Lecture 12: Comparison Sorting. Ruth Anderson Winter 2019 CSE 332: Data Structures & Parallelism Lecture 12: Comparison Sorting Ruth Anderson Winter 2019 Today Sorting Comparison sorting 2/08/2019 2 Introduction to sorting Stacks, queues, priority queues, and

More information

Data Structure. IBPS SO (IT- Officer) Exam 2017

Data Structure. IBPS SO (IT- Officer) Exam 2017 Data Structure IBPS SO (IT- Officer) Exam 2017 Data Structure: In computer science, a data structure is a way of storing and organizing data in a computer s memory so that it can be used efficiently. Data

More information

Abstract Data Structures IB Computer Science. Content developed by Dartford Grammar School Computer Science Department

Abstract Data Structures IB Computer Science. Content developed by Dartford Grammar School Computer Science Department Abstract Data Structures IB Computer Science Content developed by Dartford Grammar School Computer Science Department HL Topics 1-7, D1-4 1: System design 2: Computer Organisation 3: Networks 4: Computational

More information

Treaps. 1 Binary Search Trees (BSTs) CSE341T/CSE549T 11/05/2014. Lecture 19

Treaps. 1 Binary Search Trees (BSTs) CSE341T/CSE549T 11/05/2014. Lecture 19 CSE34T/CSE549T /05/04 Lecture 9 Treaps Binary Search Trees (BSTs) Search trees are tree-based data structures that can be used to store and search for items that satisfy a total order. There are many types

More information

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Introduction to Algorithms Preface xiii 1 Introduction 1 1.1 Algorithms 1 1.2 Analyzing algorithms 6 1.3 Designing algorithms 1 1 1.4 Summary 1 6

More information

12 Abstract Data Types

12 Abstract Data Types 12 Abstract Data Types 12.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT). Define

More information

1. Attempt any three of the following: 15

1. Attempt any three of the following: 15 (Time: 2½ hours) Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written

More information

4.1.2 Merge Sort Sorting Lower Bound Counting Sort Sorting in Practice Solving Problems by Sorting...

4.1.2 Merge Sort Sorting Lower Bound Counting Sort Sorting in Practice Solving Problems by Sorting... Contents 1 Introduction... 1 1.1 What is Competitive Programming?... 1 1.1.1 Programming Contests.... 2 1.1.2 Tips for Practicing.... 3 1.2 About This Book... 3 1.3 CSES Problem Set... 5 1.4 Other Resources...

More information

Introduction to Algorithms Third Edition

Introduction to Algorithms Third Edition Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Introduction to Algorithms Third Edition The MIT Press Cambridge, Massachusetts London, England Preface xiü I Foundations Introduction

More information

CSC Design and Analysis of Algorithms. Lecture 7. Transform and Conquer I Algorithm Design Technique. Transform and Conquer

CSC Design and Analysis of Algorithms. Lecture 7. Transform and Conquer I Algorithm Design Technique. Transform and Conquer // CSC - Design and Analysis of Algorithms Lecture 7 Transform and Conquer I Algorithm Design Technique Transform and Conquer This group of techniques solves a problem by a transformation to a simpler/more

More information