{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS notes 3

CS notes 3 - Static Classes Big O Order of Complexity...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Doubly Linked Lists and Big O Wednesday, January 26, 2011 3:22 PM Declaration of Node Node ptr; o Does not create a new node. "Declaration of intent"- has value of null o Only created when: new Node(…) Linked List Variations LL- last node points to nothing CLL- last node points back to first DLL- each node points to both front and back Fundamental Linked List Operations Stepping through nodes (managing links) Adding a node (arranging/rearranging links) Deleting a node (arranging/rearranging links) Searching (stepping + comparing) Deleting (searching + deleting) Inserting into a sorted list (searching + adding node) LinkedList vs Mode No standard LinkedList Class
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Static Classes Big O Order of Complexity Linear Time • Depends on/directly proportional to size (e.g. search in list O(n)) Constant Time • Independent of input size (e.g. array[i], removing front from LinkedList O(1)) Quadratic Time • Selection Sort (Worst Case O(n^2)) • Insertion Sort (Worst Case O(n^2)) Best/Worse/Average Case Why Big O? • Generalizes run-time regardless of computer specs • Independent of hardware, programming language, control structure (for/while/recursion) • Relevant when comparing things Time-space tradeoff • More memory-> possible to redo algorithm to go faster (e.g. hashtable)...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online