Download presentation
Presentation is loading. Please wait.
Published byAubrey Ross Modified over 9 years ago
1
CSCI 62 Data Structures Dr. Joshua Stough September 2, 2008
2
About CSCI 62 Abstract Data Types Inheritance, interfaces – adv programming Algorithms – efficiency (space, time) Move to C++ Is CSCI 62 right for you? Requirements / prerequisites –CSCI 51, or substantial AP course
3
Course Web Pages Sakai system login: –https://sakai.claremont.edu ~jstough/teaching/CS62F08/CS62F08.html~jstough/teaching/CS62F08/CS62F08.html Course Documents Assignments Checking Grades
4
How to get access Not a CMC student: see Bruce Frost at Bauer 21 (that is this building) and get your computer account set up. The process takes about five minutes or so. You MUST have an account set up to be able to hand in your homework assignments electronically. After-hour access into Adams for non-CMC students - Need to activate your card for the card reader - do the following: fill out the list being circulated. When the paper work is done, you will be asked to go to Story House (building immediately south of Collins Dining Hall) to get your card activated.
5
Lecture Format Review previous material –questions Present new material In-class exercises Lecture notes will be posted, but may be modified shortly after lecture.
6
Office Hours and Tutors M 4PM, W 3PM-on, F 3PM. All 2 nd Adams. Anytime I am in Collins. Please come to office hours.
7
Software Java SDK. Eclipse –on public lab machines http://www.claremontmckenna.edu/its/StudentG uide/Labs/default.phphttp://www.claremontmckenna.edu/its/StudentG uide/Labs/default.php you can install on your machine After-hours access –Email Patrice Tonnis, ptonnis@cmc.edu, and request card activation.ptonnis@cmc.edu
8
Grades Assignments40% –both programs and book Midterms 20% Final 30% Attendance and Participation10% _____________________ Total100%
9
Assignments Please submit electronic copies by 11:59PM on the due date. –turn in using Sakai dropbox Homework assignments –practice for exams Programming assignments –budget 10-15 hours per program design, code, debugging –start early!
10
Submitting Assignments All assignments will be submitted through Sakai drop box. Submission Errors –I will email you and give a deadline for re-submitting –not checking your email is not an excuse for missing the deadline
11
Late Policy Late Assignments lose 10, 15, 25, 25, 25% for each additional day late (no credit on the fifth day). This scale may be delayed given the severity of your circumstances and my being informed of them in a timely manner. I will defer to the Counseling Center (see http://www.cuc.claremont.edu/counseling). http://www.cuc.claremont.edu/counseling If you have an athletic event and will not be able to make a deadline, you should tell me within a day of an assignment being posted.
12
Approaching an assignment Before you open eclipse and start coding (and asking for help): –read the assignment –think about what the assignment is asking for –review lectures and examples on the topic –write (yes, on paper) your plan for completing the assignment (i.e., your algorithm) talk to/email me if you’re having trouble at this point
13
Backup Your Work! Backup your work! You will lose something at some point –you might have to learn the hard way Use your U: drive 607-0911
14
Collaborating You should –Struggle with the material before seeking help. –Come to office hours, email me. –Make sure you understand the solutions you receive help on, whether from fellow students or me.
15
Sending Email to me Put CSCI 62 in subject line For example: –CSCI 62, I’m lost –CSCI 62, This course is too easy
16
Eclipse and Java http://www.eclipse.org/downloads/ –Eclipse IDE for Java Developers (85 MB) –Or download from the course schedule. http://www.java.com/en/download/
17
Abstract Data Types Data structures are for the efficient storage, retrieval and manipulation of data.
18
Linked Lists Three classes (typically) working together –an “item” class one atomic unit of the aggregate data e.g., a “Name” class (item) might have two instance variables String first, last; –a “node” class one “item” and a reference to the next “node” the next reference is the “link” in “linked list” –a “list” class reference to the first “node”—head of the list
19
Linked Lists data Item nextNode Node List head Node
20
Linked Lists New List head Node List head Node
21
Linked Lists Find List head Node
22
Linked Lists Insert Node List head Node
23
Linked Lists Delete List head Node
24
Stacks Like a stack of paper (or cafeteria trays) –“last-in first-out” (LIFO) can only add to the top - push can only remove from the top - pop Why? –Often used to keep track of execution in a program when returning from a method call, the computer has to remember where it last was
25
Stack top Node Only have access to the top of the stack May be implemented as a linked list
26
Queues Standing in line –“first-in first-out” (FIFO) add to the “tail” of the list (back of line) - enqueue remove from the “head” (head of line) - dequeue Why? –often used to keep things in the order that they arrived –processes to be scheduled on the CPU –packets arriving to a router
27
Queue head Node Only have access to the head and tail of the queue May be implemented as a linked list tail
28
Trees Nodes can have more than one link Links are bi-directional –forward link points to children –backward link points to parent Why? –keeping items in sorted order easy to add things in sorted order –fast search –also often used to parse arithmetic expressions (order of operations)
29
Binary Trees Every node has a parent, except head Every node has at most two children root - has no parent leaf - has no children root leaves
30
Binary Trees And Expressions (3 + 2) * 5 * 5 + 3 2 Called a parse tree 3 + 2 * 5 + * 3 2 5 Evaluate deepest expressions first.
31
Binary Search Tree The first item added is the root Items less than the root go on the left branch Items greater than the root go on the right branch Makes searches very efficient 3 51 4 7 possible order added: 3 1 5 4 7 3 1 5 7 4 3 5 1 7 4 3 5 1 4 7
32
Move to C++ // In C++ #include using namespace std; int main () { cout << "Welcome to C++"; return 0; } // In Java public class Hello { public static void main(String[]args) { System.out.println("Welcome to Java"); }
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.