6 Pages

day20

Course: COP 3503c, Spring 2001
School: UCF
Rating:
 
 
 
 
 

Word Count: 599

Document Preview

3503 COP Computer Science II CLASS NOTES - DAY #20 Linked Lists Chapter 16 General Characteristics Allow general access (i.e., not constrained to the beginning or end of the list as with a stack or a queue). Consists of dynamically allocated nodes (containing both a data section and a reference section) that are connected together. Singly Linked List Each node contains a reference to the next node in the...

Register Now

Unformatted Document Excerpt

Coursehero >> Florida >> UCF >> COP 3503c

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
3503 COP Computer Science II CLASS NOTES - DAY #20 Linked Lists Chapter 16 General Characteristics Allow general access (i.e., not constrained to the beginning or end of the list as with a stack or a queue). Consists of dynamically allocated nodes (containing both a data section and a reference section) that are connected together. Singly Linked List Each node contains a reference to the next node in the list. The last node in the list contains a reference to null, indicating that it is the last node in the list. Movement through the list is uni-directional, i.e., one-way. A head Recall that the basic operations that are needed on a linked list are: insert, delete, and find at the minimum, but helper operations are extremely useful. Java Implementation //definition of a node class public class Node { public Object data; public Node next; private Node ( ) { } //defeats improper instantiation public Node (Object x) //constructor for Node alpha = new Node (x); { data = x; null x next = null; } //end constructor public Node (Object x, Node n) //for Node beta = new Node (x, alpha); { data = x; next = n; x } //end constructor } //end class Node n Day 20 - 1 B C null Single Linked List Implementation in Java public class Singly_Linked_List { private Node header; private Node current; public Singly_Linked_List ( ) { header = new Node(null, null); gotoHeader ( ); } // end constructor // NOTE: header eliminates the special case for insertion as // now all nodes have at least one node in front of them. public void resetList ( ) { header.next = null; } //end resetList public boolean isEmpty ( ) { return (header.next = = null); } // end isEmpty public void gotoHeader ( ) { current = header; } //end gotoHeader public void gotoFirst ( ) { current = header.next; } //end gotoFirst public void walkForward ( ) { current = current.next; // } end walkForward public void insert (Object x) // new node inserted between current and current.next { if (current = = null) System.out.println(ERROR); else { Node newN = new Node( x, current.next); current.next = newN; current = newN; } // end if-else } // end insert Day 20 - 2 public void remove (Node n) //removes the node after node n in the list { if (current = = null) System.out.println(ERROR); else { Node temp = current.next; n.next = temp; current = n; } // end if-else } // end remove public Node find (Object x) { Node finder = header; Node temp = header; while (finder.next != null && !finder.next.data.equals (x)) { temp = finder; finder = finder.next; } current = finder.next; return temp.next; } // end find public Node get (Object x) { Node n = find (x); // assume the user does something like the following after doing a find (x) // if (current = = null) // { current = n; // System.out.print(x + Not Found); // } return current; } // end get } // end Singly_Linked_List Day 20 - 3 Details Of How It Works Shown below is a diagram of how insert works: list before insert: A current list after insert: A D D current E newN Shown below is a diagram of how remove works: list before remove: A B current list after remove: A current B C temp D C temp D Day 20 - 4 Shown below are diagrams which illustrate how find works: Assume this initial list for all cases: null header Case #1: find (B) null header finder temp null header temp A finder B current C A B C null A B current C null Note: Reference to node containing A is returned Case #2: find (D) null header temp finder null header temp A B C A finder B C Day 20 - 5 null header A temp B finder C null header A B temp C finder At this point finder.next = null so the loop ends and a reference to the node containing C is returned (temp.next) Day 20 - 6
Textbooks related to the document above:
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

UCF - COP - 3503c
COP 3503 Computer Science II CLASS NOTES - DAY #20 Supplement Although the concept of linking is common to all linked lists, a number of other issues can affect the implementation of a linked list in different fashions. Many of the design considera
UCF - COP - 3503c
COP 3503 Computer Science II CLASS NOTES - DAY #21 Doubly Linked Lists Better than singly linked list as they are bi-directional. Has both a header and a tail node (for the same reason that we added the header node to the singly linked list). nul
UCF - COP - 3503c
COP 3503 Computer Science II CLASS NOTES - DAY #22Chapter 17 TREES Techniques for defining a tree There are two basic techniques that can be used to define a tree. 1. Recursively: this allows for very simple algorithms to manipulate the tree. 2.
UCF - COP - 3503c
COP 3503 Computer Science II CLASS NOTES - DAY #23 Huffman Coding Tree public class HuffNode { protected boolean children; protected char root; protected HuffNode left; protected HuffNode right; public HuffNode ( ) { children = false; root = null;
UCF - COP - 3503c
COP 3503 Computer Science II CLASS NOTES - DAY #23 SupplementHuffman Coding RevisitedExample: Suppose that we have a four letter alphabet consisting of a, b, c, and d, and e only. To encode four letters requires 2 bits. Suppose that these are a
UCF - COP - 3503c
COP 3503 Computer Science II Spring 2000 - CLASS NOTES - DAY #24 Hashed Tables Hash tables (files) rely on hashing to perform insertion, deletion, and retrieval in constant time. Hashing functions are a mapping between a key value and a location
UCF - COP - 3503c
COP 3503 Computer Science II CLASS NOTES - DAY #25 Priority Queues A priority queue is a structure where the highest priority item is the next item that will be dequeued. Implementation typically sets the highest priority item to have the lowest
UCF - COP - 3503c
COP 3503 Final Exam Practice ProblemsThese problems are similar in nature to those that you will see on the final exam. The final exam in comprehensive and not every topic that we have covered is represented here so dont study for the final based u
UCF - COP - 3503c
COP 3503H Spring 2001 Homework - Induction Proofs For each of the following conjectures, produce an induction proof which proves the conjecture is true. Note that all of these conjectures are true.1. n 1, and n natural numbers, it is true that
UCF - COP - 3503c
COP 3503H Spring 2001 - Homework - Induction Proofs SOLUTIONS For each of the following conjectures, produce an induction proof which proves the conjecture is true. Note that all of these conjectures are true.1. n 1, and n natural numbers, it is
UCF - COP - 3503c
COP 3503 Final Exam Practice Problems - SOLUTIONS 1. For the binary tree shown below, show the output of a preorder traversal of the tree. Foradditional practice do: inorder, postorder, and level order traversals.ABEC DF G H IPreorder
UCF - COP - 3503c
COP 3503H Mid-term Exam Spring 2001Thursday March 1, 2001 [100 points] NO CALCULATORS MAY BE USED!NAME:KEYStudent ID:1. (15 points Induction Proof) Shown below is a conjecture. Complete an induction proof that proves the conjecture is tru
UCF - COP - 3503c
COP 3503H Spring 2001 Programming Assignment #1Points: This assignment is worth 100 points. [program 60pts write-up 40 pts] Due Date: Thursday February 15, 2001 in class ObjectiveIn class we discussed three different algorithms, each of differen
UCF - COP - 3503c
COP 3503H Spring 2001 Programming Assignment #2Due Date: March 27, 2001 at class time. Points: 100 total program 60 points, write-up 40 points Objective: You will implement the Insertion sort, the Shell sort, and the Quick sort algorithms (all of
UCF - COP - 3503c
COP 3503 Honors OverviewProject #3 PresentationIn this project you will research a data structure which will not be covered in the class. You will prepare a short paper and deliver a presentation to the class on the data structure that you have
UCF - COP - 4710
COP 4710 Fall 2007 Course CalendarAugustSunday MondayTuesday7 14 21 Classes Begin IntroductionWednesday1 2 9 16Thursday3FridaySaturday4 11 18 255 12 196 13 208 15 2210 17 2423 Chapter 1 Notes 30 Chapter 2 Notes262728
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Introduction to Database SystemsInstructor : Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science Universi
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Introduction to Database SystemsInstructor : Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science Universi
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 2 Introduction to Data ModelingInstructor :Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science Univer
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 2 Introduction to Data ModelingInstructor :Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science Univer
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 2 In Class ExercisesInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University of
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 2 In Class ExercisesInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University of
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 3 The Relational Data ModelInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science Un
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 3 The Relational Data ModelInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science Un
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 3 In Class ExercisesInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University of
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 3 In Class ExercisesInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University of
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 4 Relational Query Languages Part 1Instructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Scien
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 4 Relational Query Languages Part 1Instructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Scien
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 4 Relational Query Languages Part 2Instructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Scien
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 4 Relational Query Languages Part 2Instructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Scien
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 5 Introduction To SQL Part 1Instructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 5 Introduction To SQL Part 1Instructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 5 Introduction To SQL Part 2Instructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/ccop4710/fall2007School of Electrical Engineering and Computer Science
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 5 Introduction To SQL Part 2Instructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/ccop4710/fall2007School of Electrical Engineering and Computer Science
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 9 Data StorageInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University of C
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 9 Data StorageInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University of C
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 19 NormalizationInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University of
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapter 19 NormalizationInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University of
UCF - COP - 4710
COP 4710: Database Systems Fall 2007CHAPTER 22 Parallel and Distributed Database SystemsInstructor : Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Comp
UCF - COP - 4710
COP 4710: Database Systems Fall 2007CHAPTER 22 Parallel and Distributed Database SystemsInstructor : Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Comp
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapters 10 and 11 IndexingInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University
UCF - COP - 4710
COP 4710: Database Systems Fall 2007Chapters 10 and 11 IndexingInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science University
UCF - COP - 4710
COP 4710: Database Systems Fall 2007CHAPTERS 16 & 17 Transaction ProcessingInstructor :Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Scienc
UCF - COP - 4710
COP 4710: Database Systems Fall 2007CHAPTERS 16 & 17 Transaction ProcessingInstructor : Dr. Mark Llewellyn markl@cs.ucf.edu HEC 236, 407-823-2790 http:/www.cs.ucf.edu/courses/cop4710/fall2007School of Electrical Engineering and Computer Science
University of Texas - HDF - 338
1. What is head start? a. A federal program begun in 1965 as a legislative effort to break into, and alter, the poverty cycle. b. It is a comprehensive preschool program providing healthcare and nutrition services to families, including special needs
University of Texas - HDF - 378k
1. What are some philosophical differences between ECSE and ECE? a. ECSE- early childhood special education i. Free or on sliding scales. ii.Measures and tracks development. iii.Values family participation. iv.Transition is emphasized. v.Focus is on
University of Texas - HDF - 338
Final exam notesDec. 1st 2008As kid begins to learn about herself and world, her understanding begins with: The child Family Neighborhood 3 or 4 years old Community Culture Universe beings with herself, extends to her family, and then t
University of Texas - HDF - 338
1. What is the minimum square footage per child recommended for environments? a. Accreditation i. 35 inside; recommended 50 ii.75 outside b. Texas i. 30 indoors ii.80 outside 2. What is the measure of unit blocks? a. 1 3/8 X 2 X 5 3. As the professio
University of Texas - SPN - 508
SPN 508K Primavera 2009 Lectura 1: Segunda carta de relacin por Hernn Corts Paso 1. Imagine that you are a conquistador or explorer from the Sixteenth Century. After many dangerous experiences at sea, you finally discover a new land that nobody from
University of Texas - HDF - 339
1. 2. 3. 4. 5. 6. 7. 8.Anti biased approach Who was the author of the first picture book What are the four domains used in research for documenting development Sputnik headstart Who advocated games spontaneously invented Offer education to infants
University of Texas - SPN - 508
Mi rutina diaria. Indicate which word in each line contains an error Siempre me bao muy rpido y desayuno caf y tostadas. Me gusta mucho las tostadas. _C_ A B C Me despierto todos los das a las seis de la maana porque la universidad es _ A B C en el c
Cornell - BIO - 110
Bio G 110 Prelim I Spring 2008 Two of the following essays will appear on the First Prelim. Essay 1: How did Robin Warren and Barry Marshall demonstrate the cause of ulcers? Essay 2: How did Walter B. Cannon come up with the concept of Fight or Fligh
Cornell - BIO - 110
The only name you need to know is Walter Cannon. 12.1 Insulin is produced in the A) B) C) D) E) Stomach Small Intestine Liver Pancreas Testes12.2 Glycogen is produced in the A) B) C) D) E) Pancreas Gall bladder Heart Lung Liver12.3 The hormone th
Cornell - BIO - 110
Ma2.25 14.1 Archimedes statement, Give me a place to stand-and I shall move the world implies the importance of A) an anchor to generate force against. B) tools C) gravity D) electricity E) electrons 14.2 Muscles are anchored to bones by the A) fast
Cornell - BIO - 110
Course Goals: How your body works. The creative process of discovery. How we know what we know The relationship between bio and society KNOW THYSELF I am what I eat: the big picture: digestive, respiration What is life? Life is a mixture of atoms or
Cornell - BIO - 110
REVIEW GUIDE FOR BIOG 110 PRELIM #1 You have a number of resources to help you prepare for Prelim #1. Each of the following is posted on the BioG110 Blackboard site. Potential Prelim essay questions written by Professor Wayne (recall 1 of the posted
Cornell - BIO - 110
The following essay question will appear on the BIO G 110 prelim II: Marshall Nirenberg's essay entitled, "Will society be prepared?" was written in 1967. Discuss his essay in terms of gene therapy and genetic enhancement. You will find relevant info
Cornell - BIO - 110
Essay 1: How did Robin Warren and Barry Marshall demonstrate the cause of ulcers? The idea that stress causes ulcers was widely accepted until Warren and Marshall proved otherwise. Warren noticed that many of his patients who had stomach problems als
Cornell - BIO - 110
Pro-Trangenic CropMac Bishop Alex Floes Austin Heiman Ben HellerTransgenic Crop PlantsThe ProcessTrangenetic Recombinant Crops Using recombinant DNA to genetically alter plants has only been around since the 1970s. This method, called transfo
Cornell - BIO - 110
Transgenic Crop PlantsThe Process
Cornell - BIO - 110
3.1 Carbon atoms found on earth were synthesized: 1) by the breakdown of water in lakes 2) during the first second of the big bang 3) by photosynthesis 4) in the interior of stars and we are all formed from stardust 5) by respiration 3.2 Proteins are