Why do we use asymptotic notation to analyse run time of algorithms in theoretical analysis
Usually an algorithm that is asymptotically more efficient is the best choice for all but very small inputs
- we can also use asymptotic notation to characterise other features of algorithms such as space (memory) used
What are data structures?
data structures are specific methods for storing and accessing information
Describe the features and functionality of arrays
describe features of linked lists
describe the difference between singly and doubly linked lifts
Why would we use linked lists over arrays?
They are much more efficient
name all the update methods that can performed on a linked-list abstract data type
What are the steps for an element insertion of insertAfter(p,e)
What is the cost of the insertion and removal methods for a linked list?
What is the advantage of using an array over a linked list?
They are easier and quicker to search through due to use of indexes
Describe the features of an ordered dictionary
What is a look up table/sorted table
describe the pseudocode for a binary search algorithm
What is the recursive relation for the recursive binary search algorithm and what is the time complexity of this algorithm?
T(n) = {b, if n < 2 : t(n/2) + b, if n >= 2}
- where b is a constant that denotes the time for updating low and high and other overhead
- since n/2 is the highest order term and it can be shown the binary search performs 2^n operations
- which can be written as log2(n) operations, the time complexity = O(logn)
Why is T(n) = {b, if n < 2 : t(n/2) + b, if n >= 2} the recursive relation for the recursive binary search algorithm?
Compare the time complexities of the linked list and a sorted array (look up table) for methods findElement, insertItem, removeElement, closestKeyBefore:
linked list:
findElement - O(1)
insertItem - O(n)
removeElement - O(1)
closestKeyBefore - O(1)
sorted array:
findElement - O(logn)
insertItem - O(n)
removeElement - O(n)
closestKeyBefore - O(logn)
Compare linked lists to sorted arrays in words:
Why are binary search trees an efficient data structure of linked lists and arrays?
Describe the features of a rooted tree ADT
What are sibling nodes defined as having?
Sibling nodes have the same parent node
What does it mean if a tree ABT is said to be ordered?
a tree is ordered if there is a linear ordering defined for the children of each internal node
What are binary search trees?
What does it mean for a binary tree to be ‘Proper’
It means that each node in the tree has exactly 2 children.
How can the depth of a node v be easily computed by a recursive function?