Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Reactive programming wikipedia , lookup
Recursion (computer science) wikipedia , lookup
Backpressure routing wikipedia , lookup
Rete algorithm wikipedia , lookup
Computer cluster wikipedia , lookup
Dijkstra's algorithm wikipedia , lookup
Signal-flow graph wikipedia , lookup
CSCI 62 Data Structures Dr. Joshua Stough September 2, 2008 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 Course Web Pages • Sakai system login: – https://sakai.claremont.edu • ~jstough/teaching/CS62F08/CS62F08 .html • Course Documents • Assignments • Checking Grades 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. Lecture Format • Review previous material – questions • Present new material • In-class exercises • Lecture notes will be posted, but may be modified shortly after lecture. Office Hours and Tutors • M 4PM, W 3PM-on, F 3PM. All 2nd Adams. • Anytime I am in Collins. • Please come to office hours. Software • Java SDK. • Eclipse – on public lab machines • http://www.claremontmckenna.edu/its/StudentG uide/Labs/default.php • you can install on your machine • After-hours access – Email Patrice Tonnis, [email protected], and request card activation. Grades • Assignments 40% – both programs and book • Midterms 20% • Final 30% • Attendance and Participation 10% _____________________ • Total 100% 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! 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 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). • 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. 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 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 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. Sending Email to me • Put CSCI 62 in subject line • For example: – CSCI 62, I’m lost – CSCI 62, This course is too easy 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/ Abstract Data Types • Data structures are for the efficient storage, retrieval and manipulation of data. 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 Linked Lists List Item data Node Item nextNode head Node Node Node Node Node Node Linked Lists New List head Node Node Node Node Node Node List head Node Node Node Node Node Node Node Linked Lists Find List head Node Node Node Node Node Node Linked Lists Insert List head Node Node Node Node Node Node Node Linked Lists Delete List head Node Node Node Node Node Node 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 Stack Stack top Node Node Node Node Node Node May be implemented as a linked list Only have access to the top of the stack 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 Queue Queue head Node Node Node Node Node Node tail May be implemented as a linked list Only have access to the head and tail of the queue 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) Binary Trees • Every node has a parent, except head root • Every node has at most two children • root - has no parent • leaf - has no children leaves Binary Trees And Expressions (3 + 2) * 5 Called a parse tree 3+2*5 + * + 3 5 2 3 * 2 Evaluate deepest expressions first. 5 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 1 5 4 7 possible order added: 31547 31574 35174 35147 Move to C++ // In C++ #include <iostream> 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"); } }