and Answers
Who is the author of a book entitled "Algorithms + Data Structures = Program" -
Answer- Niklaus Wirth
Profiling - Answer- is a way to measure the time cost of an algorithm using the
computer's clock to obtain an actual run time
___________ and ____________ is the two most significant resources that we try to
optimize seriously in algorithm analysis. - Answer- time, memory
_____________________ is a method of determining the efficiency of algorithm by
counting their basic operation such as addition, multiplication, comparison using
simple algebra, pencil and paper. - Answer- complexity analysis
Put these Big O growth functions into the right order from the fastest to the slowest -
Answer- 1. O(1)
2. O(log n)
3. O(sqrt(n))
4. O(n)
5. O(n**2)
6. O(2**n)
7. O(n!)
8. O(n**n)
Put these Big O categorization name into the right order from the fastest to the
slowest - Answer- 1. Constant
2. Logarithmic
3. Linear
4. Quadratic
5. Exponential
6. Combinatoric
What is the Big O of the sequential search function? - Answer- O(n)
What is the Big O of the binary search function? - Answer- O(log n)
What is the Big O of the selection sort function? - Answer- O(n**2)
What is the Big O of the bubble sort function? - Answer- O(n**2)
What is the Big O of the bubble sort with a tweak function? - Answer- O(n**2)
What is the Big O of the insertion sort function? - Answer- O(n**2)
, What is the Big O of the merge sort function? - Answer- O(n log n)
What is the Big O of the counting sort function? - Answer- O(n)
What is the Big O of the Recursive Fibonacci? - Answer- O(2**n)
______________ is a strategy that saves computed values for subsequent use, so
they will not have to be recomputed - Answer- memoization
One of the important algorithm techniques is the divide and conquer methods.
Explain divide and conquer with your own words and give an example. - Answer-
Binary search, splits data into 2 parts
Put these sorting algorithms into the right order from the fastest to the slowest
according to their average case - Answer- 1. Counting Sort
2. Merge Sort
3. Insertion Sort
4. Bubble Sort with Tweak
5. Bubble Sort
6. Selection Sort
The == operation for two lists must - Answer- Compare pairs of items at each
position for equality
Examples of unordered collections are - Answer- Sets and dictionaries
The filter function creates a sequence of the - Answer- Items in a given collection
that pass a Boolean test
A graph collection best represents a - Answer- Map of flight paths between cities
The == operation for two sets must - Answer- Verify that the sets are of the same
size and that each item in one set is also in the other set
In Python, a type conversion operation for two collections - Answer- Creates copies
of the objects in the source collection and adds these new objects to a new instance
of the destination collection
A hierarchical collection can represent a - Answer- File directory system
Examples of linear collections are - Answer- Lists and stacks
The map function creates a sequence of the - Answer- Results of applying a function
to the items in a given collection
The for loop on a list visits its items - Answer- At each position, from the first one
through the last one
Choose all the IMMUTABLE data structures - Answer- Strings, Tuples