Study sets, textbooks, questions
Upgrade to remove ads
Terms in this set (42)
Window maintained by application (where we type and read text)
Allows us to create a visual representation for data analysis
Redirecting the output of one program to the input of another
Looking for an item in an already sorted list by eliminating large portions of the data on each comparison (hi and lo)
Data is stored and piped from a whitelist
Scientific Method for Analyzing Runtime
OBSERVE some feature in the natural world
HYPOTHESIZE a model consistent with observations
PREDICT events using hypothesis
VERIFY the predictions by making further observations
VALIDATE by repeating until hypothesis and observations agree
What datatype is used for measuring runtime?
Stopwatch which has an elapsedTime() method
3 Fundamental abstract data types (ADTs)
Bag, stack, and queue
Defines a finite, deterministic, and effective problem solving method suitable for implementation
List the different types of sorting methods
List the different types of searching algorithms
Binary search trees
Balanced search trees
List the different types of graphs
Depth first search
Breadth first search
Kruskal's and Prim's algorithms for finding minimum spanning tree
Dijkstra's and the Bellman Ford algorithms for solving shortest-paths problems
Properties of methods
- arguments are passed by value
- ames can be overloaded
- has a single return value but can have multiple return statements
- can have side effects (void methods consume input/produce output)
3 important rules for recursion
There is a base case first
Recursive calls must address subproblems that are smaller
Recursive calls should not address subproblems that overlap
The process of defining and using data types
abstract data type
A data type whose representation is hidden from the client
What does encapsulation allow?
- independent development of client and implementation code
- substitution of implementations without affecting clients
- support programs not yet written
What are application programming interfaces (APIs) susceptible to?
- too hard to implement
- too hard to use
- too narrow
- too wide
- too general
- too specific
- too dependent on a particular representation
APIs describe what two features?
Generics and iterable collections
What is a bag?
A collection where removing items is not supported. Its purpose is to provide clients with the ability to collect items.
What is a stack?
A collection that abstracts a LIFO (Last In First Out) data structure
What is a queue?
A collection that abstracts a FIFO (First In First Out) data structure
What is an orphan?
An element that can never be accessed again
A recursive data structure that is either empty (null) or a reference to a node having a generic item and a reference to a linked list
An abstract entity that might hold any kind of data
What operations do priority queues support?
Remove the maximum and insert
What is the binary heap data structure?
it can efficiently support the basic priority queue operations. Keys are stored in an array such that each key is guaranteed to be larger than or equal to the keys at two other specific positions.
What is reheapifying?
The heap operations that we consider work by first making a simple modification that could violate the heap condition, then traveling through the heap, modifying the heap as required to ensure that the heap condition is satisfied everywhere
What does swim refer to?
Bottom up reheapifying. Corresponds to a promising new manager arriving on the scene and being promoted up the chain of command.
What does sink refer to?
Top down reheapifying. Refers to the president of a company resigning and being replaced by someone on the outside.
What does insert do in the heap?
We add the new key at the end of the array, increment the size of the heap, then swim up through the heap with that key to restore the heap condition
What does remove the maximum do in the heap?
We take the largest key off the top, put the item from the end of the heap at the top, decrement the size of the heap, then sink down through the heap with that key to restore the heap condition.
What is heapsort?
its broken into two phases, heap construction, where we reorganize the original array into a heap, and the sortdown, where we pull the items out of the heap in decreasing order to build the sorted result.
A table to describe an abstract mechanism where we save info (a value) that we can later search for and retrieve by specifying a key
What are the two parts of hashing?
1) to compute a hash function that transforms the search key into an array index
2) a collision resolution process to deal with two or more different keys possibly hashing to the same array index
What are the two different approaches to collision resolution?
Separate chaining and linear probing
What is hashing an example of?
A time-space tradeoff
What does the hash function depend on?
The key type being used (different hash functions for each key type)
What are the three primary requirements in implementing a good hash function?
1) it should be consistent - equal keys must produce the same hash value
2) it should be efficient to compute
3) it should uniformly distribute the keys
What is linear probing?
When there is a collision (when we hash to a table index that is already occupied with a key different from the search key), then we just check the next entry in the table (by incrementing the index)
What three outcomes does linear probing have?
1) key equal to search key: search hit
2) empty position (null key at indexed position): search miss
3) key not equal to search key: try next entry
Binary Search Tree
A binary tree where each node has a Comparable key (and an associated value) and satisfies the restriction that the key in any node is larger than the keys in all nodes in that node's left subtree and smaller than the keys in all the node's right subtree
Students also viewed
Kontaktfragen 5.Klasse März
Einheit 9 9C Die Deutschprofis
Other sets by this creator
Mosaicos (7th Ed) Chapter 0
Stats Chapter 12