Docsity

Course Outline-Progamming Data Structures-Handout, Exercises of Data Structures and Algorithms

Toggle sidebar
bg1
1
CS2143 – Data Structures
Spring 2012
Objectives:
Main objective of this course is to enable students to understand and implement common data structures and
algorithms to manipulate those data structures using C++ techniques. Emphasis will be on a lot of practice in
writing codes to implement all the major data structures.
Introduction:
Typically, a program is a set of instructions that processes some data. In order to develop a good (efficient)
program we need to organize data in computer memory in a proper way. Organized data is called a data
structure. Study of computer science includes the study of how data (information) is organized in computer and,
how it can be manipulated and utilized by programs. It is extremely important for a student of computing
related discipline to understand the concepts of data (information) organization and manipulation.
This course will focus on data structures and basic algorithms for manipulating them. Data structures for storing
information in lists, stacks, queues, trees, graphs and tables will be covered.
Prerequisites:
CS2134 (object oriented programming and lab). You must be good in design and implementation of the
programs in C++.
Reference Material
Ref 1 Object oriented data structures using C++ by K S Easwarakumar
Ref. 2 Data structures using C++ by D. S. Malik
Ref 3 Data structures and algorithm analysis in C++
By Mark Allen Weiss
Benjamin/Cummings Publishing Company, Inc.
Ref 4. Data structures and algorithm in C++
By Adam Drozdek (second edition)
Ref 5. The following folder contains all the course material i.e. lectures, assignments etc. This folder is
update time to time. It is your responsibility to see this folder for any announcement about the
course.
\\dataserver\jinnah$\Dr. Abdul Qadir\DS-Spring2012
Grading
Grading will be based on the following four items.
ļ‚· Assignments (Programming assignments): 10%
A programming assignment will be associated with every major topic which will be given to each student
after the completion of the topic. 8 to 10 days will be given for the assignment. On due date / time each
student will submit completed assignment into the folder \\dataserver\assignments$\Data Structures and also
give demonstration of his work. Students are welcomed to discuss any problem during my consultation
hours and tutorial classes.
Docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Course Outline-Progamming Data Structures-Handout and more Exercises Data Structures and Algorithms in PDF only on Docsity!

CS2143 – Data Structures

Spring 2012

Objectives:

Main objective of this course is to enable students to understand and implement common data structures and algorithms to manipulate those data structures using C++ techniques. Emphasis will be on a lot of practice in writing codes to implement all the major data structures.

Introduction:

Typically, a program is a set of instructions that processes some data. In order to develop a good (efficient) program we need to organize data in computer memory in a proper way. Organized data is called a data structure. Study of computer science includes the study of how data (information) is organized in computer and, how it can be manipulated and utilized by programs. It is extremely important for a student of computing related discipline to understand the concepts of data (information) organization and manipulation.

This course will focus on data structures and basic algorithms for manipulating them. Data structures for storing information in lists, stacks, queues, trees, graphs and tables will be covered.

Prerequisites:

CS2134 (object oriented programming and lab). You must be good in design and implementation of the programs in C++.

Reference Material

Ref 1 Object oriented data structures using C++ by K S Easwarakumar Ref. 2 Data structures using C++ by D. S. Malik Ref 3 Data structures and algorithm analysis in C++ By Mark Allen Weiss Benjamin/Cummings Publishing Company, Inc. Ref 4. Data structures and algorithm in C++ By Adam Drozdek (second edition)

Ref 5. The following folder contains all the course material i.e. lectures, assignments etc. This folder is update time to time. It is your responsibility to see this folder for any announcement about the course. \dataserver\jinnah$\Dr. Abdul Qadir\DS-Spring

Grading

Grading will be based on the following four items.

ļ‚· Assignments (Programming assignments): 10% A programming assignment will be associated with every major topic which will be given to each student after the completion of the topic. 8 to 10 days will be given for the assignment. On due date / time each student will submit completed assignment into the folder \dataserver\assignments$\Data Structures and also give demonstration of his work. Students are welcomed to discuss any problem during my consultation hours and tutorial classes.

ļ‚· Quizzes: 10% Quizzes will be unannounced and Closed Book & Closed Notes. ļ‚· Midterms: 20% and 10% There will be at least two close book close notes midterms, one in the midterm week (20%) and other (10%) is during the 13th^ week of the semester. ļ‚· Project: 10% Each student will be given a project to solve a problem by using the topics studies in this course and the previous courses on programming. The project will be allocated after the midterm exams. Students are welcome to submit project proposal if there is any. ļ‚· Final Exam: 40% Closed Book & Closed Notes.

Attendance and Assignment Policy:

You are expected to attend all lectures and Labs. You are responsible for all material covered in the lecture as well as those in the assigned reading. However, this subject cannot be learned simply by listening to the lectures and reading the book. In order to master the material, you need to spend time outside the classroom, to think, to work out the assignment and understand the solutions.

Late assignment will not be accepted. Since you will be given partial credit for serious attempts, you should simply turn in whatever you have accomplished for the assignment when it is due. A good approach to solving the assignment problems is to work on one problem each day and to come to class or office hours with prepared questions about the problems you have not been able to solve.

Course Syllabus:

Course Contents / Topics

1. Introduction to the course and course objectives o What is Data Structures? o Why it is important to study data structures? 2. Linear data structures o Stack ļ‚§ What is stack? ļ‚§ Common stack examples. ļ‚§ Implementation of stack both static and dynamic ļ‚§ Applications of stack o Linked List ļ‚§ What is linked list? ļ‚§ Advantages of linked list over static list. ļ‚§ Implementation of linked list. ļ‚· Singly linked list ļ‚· Double linked list & ļ‚· Circular doubly linked list o Queue ļ‚§ What is a queue? ļ‚§ Implementation of Queue both static and dynamic ļ‚· Circular queue ļ‚· Priority queue ļ‚· Deques

Assignment 1 to visit atleast one web site for DS course and submit the home page of that site 1/2 Revision of Arrays & Pointers Discussion in the class, MIT OCW course Introduction to C++ and http://www.cplusplus.com/doc/tutorial/

Assignment 2 to prepare a presentation on pointers 2/3 Pointers, Dynamic Arrays, Discussion in the class, MIT OCW course Introduction to C++, and http://www.cplusplus.com/doc/tutorial/

Reading Notes as Assignment 3

Phase 1: Static Memory and Datastructures by using static memory / arrays 2/4 Array Class and then move to the use of array as a stack and Some Applications of Arrays

Relevant topic from Reference Book 1, and Applied data structures with C++ by By Peter Smith, C++ Plus Data Structures By Nell Dale, C++, object-oriented data structures By Saumyendra Sengupta, Carl Phillip From Google book Video lecture

http://academicearth.org/lectur

es/arrays-and-objects

Assignment 4 - Implementation of array and stack

3/5 Static Stack: Quiz2 and Discussion on the last assignment. Application of Stack: Balancing of Parenthesis

My lecture, Reference 1 and 2 books. Material from the net and reference course material

Assignment 5. Implementation of the stack application as discussed in the class: Balancing of Parenthesis 3/6 Static Queue: Array application as a FIFO queue and assignment 6

Reference books, my lecture and discussion in the class

Assignment 6. Implement Queue Class with FIFO behavior and make in out 0 when both are equal. Submit before next class 4/7 Static Queue: Proper implementation of the Queue empty and full logic with overflow of the index from last location of the array to the first location

Complete In and Out methods with state transition have been explained in the class. Students need to focus on the discussions in the class and practice what has been discussed in the class.

Students should get similar implementation from the net or books by themselves.

Assignment 7: Implement the static queue class and a simple application to use that class which will take into account the correct behavior of queue full and

empty. 4/8 Sorting, Selection Sort and Discussion on Time taken by it.

Need to think about some intelligent sorting algo / logic 5/9 Sorting: Insert Sort, Search by using recursive method with arrays by using mid values of the array index

Assignment 7: Tree & Array Search

5/10 BST by using Arrays and 2i+ and 2i+2 logic for traversal: Search and Insertion

As discussed in the class. Class notes are going to be most important. Also, consult BST implementation by using arrays. Do not go into the implementation by using pointers and dynamic memory. Consult relevant on line stuff available.

Assignment 9: Implementation of BST insert, search and print

6/11 BST, Insertion, AVL condition, Right Rotation

As discussed in the class. Students will implement the logic for right rotation for an array implementation of the BST.

Assignment 10: Implementation of the right rotation logic for array implementation of BST- Assignment Cancelled 6/12 Cancel due to convocation 7/13 Binary Tree: isLeaf(), parentOf(), leftChild(), rightChild(), Height() and Tree Traversal to find index of a particular value node.

As discussed in the class. You may find array implementation of these functions on the net. Better to discuss with your friends in the class and see me if there is some problem.

Assignment 10: implement all the methods discussed in the class for the array implementation of the tree. 7/14 Binary Tree structured print, tree traversal: PreOrder, PostOrder, InOrder

Class Discussions, Extra Class on coming Monday at 9:30 AM 8/15 (in place of

Simple Graph, Adjacency Matrix Implementation, Graph Input and Graph Print, Dynamic Allocation of the 2D array for graph

Class Discussions, Web Stuff related with 2D array implementation of a graph

Extra Class: Quiz No 6, Exercise: Input graph and print it in the form of a set of vertices and a set of edges 8/16/(15) (in actual)

Graph Traversal: Depth First Traversal with adjacency matrix

As discussed in the class Assignment 12. Implement DFS for adjacency matrix as implemented in

14/24 Height in BST, Detection, Right Rotation, Started AVL tree

Assignment 21: Implement left and right rotation and detect height functions 15/25 Quiz 10: AVL Simple Rotations All Functions: updateHeight, AVL violation, rotation type, rotate as per need and then again perform the updateHeight and keep on doing this till there is no node with heightviolation.

Assignment 22: Implement complete AVL tree

15/26 AVL Tree Revision, AVL Tree Double Rotations, Bonus Marks = 10 for those who submitted the assignment 22 before the class

Assignment 23: Complete AVL tree class with a simple driver program