CS 315 Data Structures B. Ravikumar Office: 116 I Darwin Hall Phone: 664 3335 Course Web site:

Slides:



Advertisements
Similar presentations
Lecture 22, Revision 1 Lecture notes Java code – CodeFromLectures folder* Example class sheets – 4 of these plus solutions Extra examples (quicksort) Lab.
Advertisements

Student Projects in the Course Data Structures
David Luebke 1 6/7/2014 CS 332: Algorithms Skip Lists Introduction to Hashing.
Data Structures.
CS 171: Introduction to Computer Science II Hashing and Priority Queues.
Hashing COMP171. Hashing 2 Hashing … * Again, a (dynamic) set of elements in which we do ‘search’, ‘insert’, and ‘delete’ n Linear ones: lists, stacks,
Review. What to know You are responsible for all material covered in lecture, the readings, or the programming assignments There will also be some questions.
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 18: Hash Tables.
Hashing CS 3358 Data Structures.
CSCE 210 Data Structures and Algorithms
CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
Welcome CS 315 Data Structures. Instructor: B. Ravikumar Office: 116 I Darwin Hall Phone: Course Web site:
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
Data Structures & Algorithms What The Course Is About s Data structures is concerned with the representation and manipulation of data. s All programs.
Quick Review of material covered Apr 8 B+-Tree Overview and some definitions –balanced tree –multi-level –reorganizes itself on insertion and deletion.
Cpt S 223 – Advanced Data Structures Course Review Midterm Exam # 2
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
Important Problem Types and Fundamental Data Structures
DATA STRUCTURE Subject Code -14B11CI211.
CSCE 3110 Data Structures and Algorithm Analysis.
Data Structures and Programming.  John Edgar2.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
WEEK 1 CS 361: ADVANCED DATA STRUCTURES AND ALGORITHMS Dong Si Dept. of Computer Science 1.
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
1 HashingHashing Alan, Tam Siu Lung
CS223 Algorithms D-Term 2013 Instructor: Mohamed Eltabakh WPI, CS Introduction Slide 1.
1 Hash Tables  a hash table is an array of size Tsize  has index positions 0.. Tsize-1  two types of hash tables  open hash table  array element type.
Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)
Design and Analysis of Algorithms CSC201 Shahid Hussain 1.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture8.
CS212: DATA STRUCTURES Lecture 10:Hashing 1. Outline 2  Map Abstract Data type  Map Abstract Data type methods  What is hash  Hash tables  Bucket.
Introduction. 2COMPSCI Computer Science Fundamentals.
Search - on the Web and Locally Related directly to Web Search Engines: Part 1 and Part 2. IEEE Computer. June & August 2006.
DATA STRUCTURES (CS212D) Week # 1: Overview & Review.
CS212: DATA STRUCTURES Lecture 1: Introduction. What is this course is about ?  Data structures : conceptual and concrete ways to organize data for efficient.
© 2006 Pearson Addison-Wesley. All rights reserved13 B-1 Chapter 13 (continued) Advanced Implementation of Tables.
Hashing COMP171. Hashing 2 Hashing … * Again, a (dynamic) set of elements in which we do ‘search’, ‘insert’, and ‘delete’ n Linear ones: lists, stacks,
DATA STRUCTURE & ALGORITHMS (BCS 1223) NURUL HASLINDA NGAH SEMESTER /2014.
Data Structures and Algorithms Lecture 1 Instructor: Quratulain Date: 1 st Sep, 2009.
Data Structures Lecture 1: Introduction. Course Contents Data Types   Overview, Introductory concepts   Data Types, meaning and implementation  
Data Structures Types of Data Structure Data Structure Operations Examples Choosing Data Structures Data Structures in Alice.
Data Structures and Algorithm Analysis Introduction Lecturer: Ligang Dong, egan Tel: , Office: SIEE Building.
COSC 2007 Data Structures II Chapter 13 Advanced Implementation of Tables IV.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
Hashing COMP171. Hashing 2 Hashing … * Again, a (dynamic) set of elements in which we do ‘search’, ‘insert’, and ‘delete’ n Linear ones: lists, stacks,
Advanced Data Structure By Kayman 21 Jan Outline Review of some data structures Array Linked List Sorted Array New stuff 3 of the most important.
Internal and External Sorting External Searching
Data Structures and Algorithms in Java AlaaEddin 2012.
DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 
CS 315 Data Structures Fall 2011 Instructor: B. (Ravi) Ravikumar Office: 116 I Darwin Hall Phone: Course Web site:
 Saturday, April 20, 8:30-11:00am in B9201  Similar in style to written midterm exam  May include (a little) coding on paper  About 1.5 times as long.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Data Structure and Algorithms
CSC 143T 1 CSC 143 Highlights of Tables and Hashing [Chapter 11 p (Tables)] [Chapter 12 p (Hashing)]
COMP 103 Course Review. 2 Menu  A final word on hash collisions in Open Addressing / Probing  Course Summary  What we have covered  What you should.
CS 315 Data Structures Spring 14 Instructors (lecture) Bala Ravikumar Office: 116 I Darwin Hall Phone: piazza, (Lab.
Mohammed I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
CSCE 210 Data Structures and Algorithms
Data Structure Interview Question and Answers
Priority Queues An abstract data type (ADT) Similar to a queue
CS 315 Data Structures B. Ravikumar Office: 116 I Darwin Hall Phone:
CS302 Data Structures Fall 2012.
Data Structures and Algorithms
Advanced Implementation of Tables
Priority Queues An abstract data type (ADT) Similar to a queue
Hash-Based Indexes Chapter 11
CSE 326: Data Structures Lecture #14
CSCE156: Introduction to Computer Science II
Presentation transcript:

CS 315 Data Structures B. Ravikumar Office: 116 I Darwin Hall Phone: Course Web site:

Textbook for the course: Data Structures and Algorithm Analysis in C++ by Mark Allen Weiss Lab: T 1 to 2:50 PM, Darwin Hall # 28

Course Goals Learn to use fundamental data structures: arrays, linked lists, stacks and queues hash table priority queue binary trees others Enhance your skill in programming in c++ recursion, classes, algorithm implementation build projects using different data structures Analytical and experimental analysis quantitative reasoning about the performance of algorithms comparing different data structures

Goals for today’s lecture Course outline Discuss Course work lab assignments projects tests, final exam If any time left, we will start discussion of recursion. (will continue it in the lab).

Data Structures – key to software design Data structures play a key role in every type of software. Data structure deals with how to store the data internally while solving a problem in order to Optimize the overall running time of a program Optimize the response time (for queries) Optimize the memory requirements Optimize other resources (e.g. network) Simplify software design make solution extendible, more robust

Abstract vs. concrete data structures w Abstract data structure (sometimes called ADT) is a collection of data with a set of operations supported to manipulate the structure w Examples: stack, queue priority queue Dictionary w Concrete data structures are the implementations of abstract data structures: Arrays, linked lists, trees, heaps, hash table w Main emphasis of the course: Find the best mapping between abstract and concrete data structures.

Abstract Data Structure (ADT) container supporting operations Dictionary search insert primary operations Delete deleteMin Range search Successor secondary operations Merge Priority queue Insert deleteMin Merge, split etc. Secondary operations primary operations

Linear data structures key properties of the (1-d) array: a sequence of items are stored in consecutive memory locations. array provides a constant time access to k-th element for any k. (access the element by: Element[k].) inserting at the end is easy. if the current size is S, then we can add x at the end using the single instruction: Element[S++] = x; deleting at the end is also easy. inserting or deleting at any other position is expensive. Even searching is expensive (unless sorted).

Images are stored in 2-d arrays w We will work on 2-d arrays by manipulating images: Each pixel is represented by a blue value, a red value and a green value (any color is a combination of these colors). (255, 255, 255) represents white, (255, 0, 0) represents red etc. pic(i, j)-> Blue represents the blue component of the i-th row, j-th column pixel of pic and so on. Some basic operations on images: open, read, write rotate, mirror image filter (remove blemishes) extract features (identify where buildings are in an aerial photograph)

Linked lists w Linked lists: Storing a sequence of items in non- consecutive locations of the memory. Not easy to search for a key (even if sorted). Inserting next to a given item is easy. In doubly linked list, inserting before or after a given item is easy. Don’t need to know the number of items in advance. (dynamic memory) order is important

stacks and queues stacks: insert and delete at the same end. equivalently, last element inserted will be the first one to be deleted. very useful to solve many problems Processing arithmetic expressions queues: insert at one end, deletion at the other end. equivalently, first element inserted is the first one to be deleted.

Non-linear data structures w Various versions of trees Binary search trees Height-balanced trees etc. Lptr key Rptr 15 Main purpose of a binary search tree  supports dictionary operations efficiently

Priority queue w Max priority key is the one that gets deleted next. Equivalently, support for the following operations: insert deleteMin w Useful in solving many problems fast sorting (heap-sorting) shortest-path, minimum spanning tree, scheduling etc.

Hashing Supports dictionary operations very efficiently (most of the time). Main advantages: Simple to design, implement on average very fast not good in the worst-case.

What data structure to use? Example 1: There are more than 1 billion web pages. When you type on google something like: You get instantaneous response. What kind of data structure is used here? The details are quite complicated, but the main data structure used is quite simple.

Data structure used - inverted index Array of lists – each array entry contains a word and a pointer to all the web pages that contain that word: Data structure This list is kept sorted 876 Question: How do we access the array index from key word? Hashing or some other clever data structure is needed.

Example 2: The entire landscape of the world is being digitized (there is a whole new branch that combines information technology and geography called GIS – Geographic Information System). What kind of data structure should be used to store all this information? Snapshot from Google earth

Some general issues related to GIS How much memory do we need? Can this be stored in one computer? (or need a distributed data base?) Building the database is done in the background (off- line processing) How fast can the queries be answered? Response to query is called the on-line processing Suppose each square mile is represented by a 1024 by 1024 pixel image, how much storage do we need to store the terrain of United States?

Calculate the memory needed Very rough estimate of the memory needed: Area of USA is 4 x 10 6 sq miles (roughly) Each square mile needs 10 6 pixels (roughly) Each pixel requires 32 bits usually. Thus the total memory needed = 4 x 10 6 x 32 x 10 6 = 168 x = Giga bits (A standard desk top has ~ 200 Giga bits of memory.) Need about 800 such computers to store the data

What data structure to store the images? each 1024 x 1024 image can be stored in a two- dimensional array. (standard way to store all kinds of images – bmp, jpg, png etc.) The actual images are stored in a secondary memory (hard disks on several servers either in a central location or distributed). The number of images would be roughly 4 x A set of pointers to these images can be stored in a 1 (or 2) dimensional array. When you click on a point on the map, its index in the array is calculated. From that index, the image is accessed and sent by a network to the requesting client.

Overview of the projects: 1)Generate all the poker hands More generally, given a set of N items and a number k<= N, generate all possible combinations or permutations of k items. (concept: recursion, arrays, lists) 2) Image manipulation: (concept: arrays, library, analysis of algorithm) 1) After filtering

3) Spelling checker: Given a text file T, identify all the misspelled words in T. Idea: build a hash table H of all the words in a dictionary, and search for each word of the text T in the table H. (concept: hashing, string processing) 4) Scheduling problem: A set of tasks should be assigned to several identical machines. What is the maximum number of jobs that can be assigned? Concept: priority queue (heap)

5) Geometric computation problem – given a set of rectangles, determine the total area covered by them. Also report all the intersections between them. Concept: binary search tree.