Shared Flashcard Set

Details

CS 136
NAU, Notecards, CS 136, Georgas
24
Computer Science
Undergraduate 2
12/18/2013

Additional Computer Science Flashcards

 


 

Cards

Term
What is polymorphism
Definition
So polymorphism is the ability (in programming) to present the same interface for differing underlying forms (data types).
Term
What is unittesting
Definition
unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures are tested to determine if they are fit for use
Term
what is super()
Definition
In python, a child class uses this method to invoke functionality defined in the parent class
Term
What is function uses O(n^2)
Definition
for i:
for i:
Term
How does binary search work?
Definition
half-interval search algorithm, halves a list.

In each step, the algorithm compares the search key value with the key value of the middle element of the array. If the keys match, then a matching element has been found and its index, or position, is returned. Otherwise, if the search key is less than the middle element's key, then the algorithm repeats its action on the sub-array to the left of the middle element or, if the search key is greater, on the sub-array to the right. If the remaining array to be searched is empty, then the key cannot be found in the array and a special "not found" indication is returned.
Term
What is inheritance?
Definition
Inheritance is used to indicate that one class will get most or all of its features from a parent class.
Term
What is compilation?
Definition
changing human language into machine language (0's , 1's

A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code).[1] The most common reason for wanting to transform source code is to create an executable program.
Term
what is Interpretation?
Definition
A software tool that immediately executes the source code specified in a high level programming language.
Term
What is overriding
Definition
Method overriding, in object oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. The implementation in the subclass overrides (replaces) the implementation in the superclass by providing a method that has same name, same parameters or signature, and same return type as the method in the parent class.
Term
what is the garbage collector
Definition
Python's virtual machine that is responsible for reclaiming the memory used by unneeded objects.
Term
A boundary is
Definition
An input that represents a separation between two equivalence partitions.
Term
Contiguous
Definition
An array data structure that stores elements next to eachother.
Term
Accessing an element at any position in the structure?
Definition
Big O for an array: O(1)
Big O for linked: O(n)
Term
adding an element at either the beginning or the end
Definition
Big O for an array: O(n)
Big O for linked: O(1)
Term
adding an element in the middle
Definition
Big O for an array: O(n)
Big O for linked: O(n)
Term
deleting an element from either the beginning or the end
Definition
Big O for an array: O(1)
Big O for linked: O(n)
Term
Deleting an element from the middle
Definition
Big O for an array: O(n)
Big O for linked: O(n)
Term
What is binary search's Big O?
Definition
O(log(n))
Term
what is the recursion of copy
Definition
def copy(lst):
if not lst:
return []
else:
return [first(lst)] + copy(rest(lst))
Term
Python is both a ____ and a _____
Definition
compiler, interpreter
Term
What does the quicksort function look like:
Definition
def partition(lst, start, end):
pos = start # condition was obsolete, loop won't
# simply run for empty range

for i in range(start, end): # i must be between start and end-1
if lst[i] < lst[end]: # in your version it always goes from 0
lst[i],lst[pos] = lst[pos],lst[i]
pos += 1

lst[pos],lst[end] = lst[end],lst[pos] # you forgot to put the pivot
# back in its place
return pos

def quick_sort_recursive(lst, start, end):
if start < end: # this is enough to end recursion
pos = partition(lst, start, end)
quick_sort_recursive(lst, start, pos - 1)
quick_sort_recursive(lst, pos + 1, end)
Term
What does Merge Sort's recursive "else" look like?
Definition
else:
if first(lst_a) < first(lst_a):
return [first(lst_a)] + merge(rest(lst_a),lst_b)
else:
return [first(lst_b)] + merge(rest(lst_a),lst_b)
Term
what is memoization
Definition
is an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously processed inputs.
Term
Big O of recursion
Definition
O(n), O(logn)
Supporting users have an ad free experience!