Shapes Notes And More

Shapes Assignments Notes

  • Don't make your shapes class extend anything.
  • Have an overall class called "Shape" with subclasses "oval" "polygon" "rectangle" etc. and have each subclass extend Shape.
  • It would be nice to have a copy-paste function in the program.
  • "maninpulator box" around each shape created by a method that overrides the "draw component" thingy.

Linked Lists

  • Binary Tree: Each node has 2 possible children, growing downwards.
    • Binary Search Tree: If it's balanced, can be searched in logn time. quite fast.
      • A sorted array is just as quick to sort through
    • Left child, right sibling: Now we have a fixed data structure with only two links, but with as much room for siblings as we want.

Inner Classes

  • quirky java thingy
  • An inner class is a class inside of the outer class that acts as a "helper."
  • The outer class has access to everything inside the inner class.

Node Inner Class Example:

public class StringLinkedList
  private ListNode head;
  private class ListNode
     // blarg



  • generics allow you to "parameterize" a data type.

Stack and Queue

Important Data structures in Computer Science. * Stack * FILO * Que *