Final Exam - Western New England University

advertisement

WESTERN NEW ENGLAND COLLEGE

SCHOOL OF ARTS AND SCIENCES

CS 284 Spring 2005

DATA STRUCTURES II

INSTRUCTOR: Dr. L. S. Tang

FACULTY OFFICE:

Location: Herman 310B

Phone:

E-mail:

(413) 782-1353 ltang@wnec.edu

Office Hours: M W F 10:00 AM - 12:00 PM

Tu Th 11:00 AM - 01:00 PM

TEXT:

“Data abstraction and Problem Solving with JAVA,” Updated Edition by Frank Carrano and Janet Prichard, Addison Wesley, 2001

COURSE OBJECTIVES:

1. To present and illustrate the role and value of abstract data types (ADTs) in the study of data structures.

2. To teach selective data structures that are important in the study and practice of computer science and software development.

3. To illustrate the value and the power of the Java language to support the use of data abstraction in the development of quality software.

4.

To introduce and exercise techniques of measuring algorithm efficiency or “complexity.”

PRE-REQUISITES: CS 283

ASSESSMENT AND WEIGHTS:

2 Hourly Exams

Final Exam (cumulative) exercise and programming assignments

40% (20% for each exam)

20%

40%

Note: (1) Class attendance and participation can significantly alter this final average. See the attendance policy that follows.

(2) Penalty for late assignments or exercises: 5% will be taken off for each class day late.

All assignments must be handed in no later than two weeks after the due date.

GRADING SCALE:

93-100 A

87-89 B+

77-79 C+

65-69 D+

90-92 A-

83-86 B

73-76 C

60-64 D

0-59 F

80-82 B-

70-72 C-

DEPT. OF MATHEMATICS AND COMPUTER SCIENCE ATTENDANCE POLICY

One of the primary objectives of the department is the success of each student that enrolls in one of our courses. We structure our support services through the MATH CENTER and our courses, including lectures, homework, class discussions, quizzes, and exams, towards that goal. We are cognizant of the multi-faceted environment that students need to succeed in our courses, and we offer such an environment for each of the students that we serve. The classroom experience is one of the most essential ingredients for student success, since a wealth of information is communicated during each class and since the instructor-student interaction that takes place during this transmission contributes greatly to the learning process. Consequently, we expect the student to attend every class. To encourage our students to continually participate in the classroom experience the department mandates that some portion of the students' final grade in a MATH/CS course be based on attendance and class participation.

At the beginning of the semester, each student will be given 2 points to be added to the student’s final average as computed above. However, for each absence these bonus points will decline by

1/2 point. Consequently, if a student has four absences during the semester, zero points are added to the final average, and if a student has five or more absences during the semester, points are subtracted from the final average. Further, 1 point can be subtracted from positive bonus points due to poor class participation.

We are aware that on a rare occasion, an emergency may arise causing a student to miss a class, and such an absence may be excused, at the discretion of the instructor, without penalty. In this instance the student is still responsible for missed material and the assignment, and it is always prudent for the student to inform the instructor prior to the absence whenever possible.

Note that to get bonus points you must BE IN CLASS. An absence for an illness, a wedding, or to catch a flight home is still an absence and will not earn bonus point! Sleep in class will be considered as absence.

MAKE-UP EXAM:

If a student should miss an exam, a make-up test may be given only if evidence can be shown which will confirm that the absence is due to circumstances beyond the student’s control (such as illness or personal emergency). In this case, the instructor must be informed prior to the exam that he/she will not be able to attend . Any excused work must be made up within one week of the student’s return to class.

ACADEMIC HONESTY:

Anyone detected cheating in an exam or homework assignment, whether aiding or being aided, will receive a zero for that examination or assignment.

WRITTEN PROFICIENCY:

In keeping with the mission statement of the College to encourage students to think clearly and to discipline their self-expression, students are expected to demonstrate, in writing, that they have assimilated the information and ideas presented in each course. Consequently, the students' written work on exams and assignments will be critically analyzed and that written performance will represent approximately 5% of the grade on that submitted material.

CS LAB:

The CS Lab is located in H115 on the first floor of Herman Hall. A schedule is published at the beginning of each semester with specific times when students in any CS course may come to the lab for help. An appointment is not needed. If a student's schedule conflicts with the hours in the schedule, he/she may call 782-1692 for an appointment during a more suitable time.

STUDENT EXPECTATIONS:

Your greatest expectations should be the ones you place on yourself. What you achieve in the course will, in part, determine how successful you will be later in life, so work for yourself. To reach your highest expectations we encourage you to consider the following guidelines: a) Work at least two hours outside of class for every hour in class. Don’t cut this time short and don’t bunch it all together. b) Take notes in class and rewrite the notes outside of class. c) Prior to attempting each problem set assignment read the appropriate material in the text and class notes, giving special attention to the solution examples discussed in class. d) Complete each assignment on time, and if needed, with the help of your student colleagues, your professor, or the CS Lab. e) Use flash card to memorize both vocabulary and basic facts. Repetitive drill is a tedious but effective way to begin learning large amounts of factual material. f) Take advantage of all avenues to success, even the ones you find not in the above list.

LEARNING DISABILITIES

If you have a documented learning disability that requires special accommodation, please call the

Learning Disability Services Office at 782-1528. Arrangements can be made to help you, but you must go through the proper channels.

DISRUPTIVE BEHAVIOR:

If a student behaves in ways that disrupt the learning environment of the classroom, or is disrespectful to the professor, he/she may be suspended from the class at the discretion of the professor. The student must then appear before the Dean of the School of Arts and Sciences. The

Dean will determine whether the student should be readmitted and, if so, the terms under which this can occur. Following readmission, if further incidents of misconduct are reported, the student is subject to dismissal from the course with a grade of F.

COURSE OUTLINE:

Chapter 4 Linked Lists

Chapter 6 Stacks

Exam 1

Chapter 7

Chapter 8

Chapter 10

Queues

Class Relationships

Trees

Exam 2

Chapter 9

Chapter 12

Final Exam

Algorithm Efficiency & Sorting

Advanced Implementations of Tables

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

OUTCOMES

Upon successful completion of the course the student will be able to:

-- code some simple operations of linked lists using access type, such as

--

1)

2)

3)

4)

5)

6)

7) delete the first node of a linked list, delete the last node of a linked list, add a node to the beginning of a linked list, add a node to the end of a linked list, traverse a linked list, given a key, search the node in a linked list, concatenate two linked lists. trace the insertion and deletion operations of a sorted list if it is implemented by array simulation of a linked list. code simple operations (as shown above) of linked lists using the array implementation. explain the concept of stacks and the primitive operations of a stack. use the stack data structure whenever it is appropriate, such as

1) to print a string a reverse order,

2) to check whether parentheses of an expression are matching up correctly,

3) to evaluate a fully parenthesized expression. convert a infix expressions to postfix and prefix expressions. trace the evaluation of postfix and prefix expressions by using a stack. identify the advantages of using postfix/prefix expressions compared to infix expressions. explain how local variables, in parameters, and return addresses are stored in stack. use a stack to trace the operations of a recursive subprogram. code basic operations if a stack is implemented as an array. code basic operations if a stack is implemented as a linked list. explain the concept of FIFO queues and the primitive operations of a FIFO queue. to trace and code basic operations if a FIFO queue is implemented as a circular array. code basic operations if a queue is implemented as a linked list. identify the equation that relates the height of a complete binary tree and the number of nodes in the tree. show the inorder, preorder and postorder traversals of the binary tree. generate the Huffman code from given frequency counts. explain the concept of binary search trees. insert new elements to a binary search tree. delete elements from a binary search tree. write code for simple binary search tree operations, such as

1) boolean found (Tree t, int key);

-- returns true or false depending whether key is in t

2) Tree copy (Tree t1);

-- returns a copy of tree t1

3) boolean equals (Tree t1, Tree t2);

-- returns true or false depending whether t1 and t2 have exactly the same tree

-- structure

4) int height (Tree t);

-- returns the height of the tree t

5) int minPath (Tree t);

-- returns the length of the shortest path from the root to any leaf

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

--

6) boolean balanced (Tree t);

-- returns true or false depending whether Tree t is perfectly balanced.

7) boolean heightBalanced (Tree t);

-- returns true or false depending whether Tree t is height balanced. calculate the maximum number and average number of comparisons if linear search is used to find an element in a sorted list. identify whether a given binary search tree is perfectly balanced, height balanced or neither. explain the concept of B-trees. insert new elements to a B-tree. delete elements from a B-tree. describe some of B-tree variants. discuss advantages and disadvantages of storing ordered lists in various data structures including

1) arrays,

2) linked lists,

3) binary search trees,

4) B-trees. explain the three common problems in using pointer variables. explain advantages and disadvantages of the hash table method. explain collision or hash clash in hash table method, and identify some common methods for resolving collisions. identify some commonly used hash functions. trace insertions and deletions to hash tables if hash collisions are resolved by

1) closed hashing using linear probing,

2) closed hashing using nonlinear probing where increment(i, p) = (i+p) mod N,

3) closed hashing using quadratic probing,

4) bucket hashing or chained hashing. explain how the efficiency of an algorithm is measured. calculate the big O of simple functions. calculate the big O simple segments of code. identify stable and unstable sorting algorithms.

When should we use a stable sorting procedure? discuss the difference between the two sorting strategies: sorting actual records and sorting by addresses (or pointers). trace the following sorting algorithms and identify each's order, best case, worst case:

Selection Sort Bubble Sort Bubble Sort with flag

Linear Insertion Sort

Quick Sort

Merge Sort

Shell Sort

Heap Sort

Download