Lecture 1 Flashcards
What is the Sieve of Erathotenes
The Sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to a given limit. It works by iteratively marking the multiples of each prime, starting from 2, up to the square root of the limit, thus efficiently identifying the primes within the specified range. O(n log log n)
What is insertion sort?
Insertion sort works by iteratively taking an unsorted element and inserting it into its correct position within the already sorted part of the array. It does this by comparing the element with its predecessors and shifting elements to make room for the insertion. O(n^2)
What is an algorithm?
Finite: Must terminate
correct: must yield correct solution
efficient: should scale polynomically
What is merge Sort?
Merge sort is a divide-and-conquer sorting algorithm that recursively divides an array into halves, sorts each half, and then merges the sorted halves to produce a fully sorted array. Its efficiency lies in its consistent O(n log n) time complexity, making it suitable for large datasets.
What is exhaustive search?
Exhaustive search, also known as brute-force search, is a problem-solving strategy that systematically explores all possible solutions to find the optimal one. It involves considering every option in a solution space, making it thorough but potentially inefficient for large or complex problems. O(n)
What is binary search?
Binary search is a divide-and-conquer algorithm for finding a target value within a sorted array. It repeatedly divides the search range in half, comparing the target value to the middle element and narrowing down the search until the target is found or the search range is empty. O(log n)
When would binary search not work?
When you have multiple answeres in the list you are searching for
What is injective?
Injective, in the context of functions or mappings, means that each distinct element in the domain is associated with a distinct element in the codomain. In simpler terms, an injective function ensures that no two different elements in the domain map to the same element in the codomain.
What is bijective?
A bijective function, also known as a bijection, is a type of function between two sets in which every element in the domain is paired with a unique element in the codomain, and vice versa. In other words, a bijective function is both injective (one-to-one) and surjective (onto), establishing a one-to-one correspondence between the elements of the domain and codomain.
What is surjective?
A surjective function, also known as onto, is a type of function where every element in the codomain has at least one pre-image in the domain. In simpler terms, the function covers the entire range of the codomain, ensuring that no element in the codomain is left unmapped.
How many bijective mappings between two sets with
|A| = |B| = n exist?
n!
How many injective mappings between two sets with |A| = n
and |B| = k, n ≤ k, exist?
C(k,n)= k! / (n!(k−n)!)
What is the Hungarian Algortihm?
The Hungarian algorithm is a combinatorial optimization algorithm used to solve the assignment problem in bipartite graphs, particularly in the context of optimizing the assignment of tasks to workers or resources. It efficiently finds the optimal assignment by iteratively augmenting the assignment along alternating paths in the bipartite graph until a maximum matching is achieved. O(n^3)
What is the Time complexity of pattern matching via Naive search?
O (m*n) m = length of pattern
What is the traveling salesman problem?
The travelling salesman problem asks the following question: “Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the city of origin?” O = (n!)
What is set matching by brute force time complexity?
n! elements are sorted in a time complexity of O = ((n!)log((n!)))
What is pattern matching?
You have a text T and a pattern P which is included in the text T how many times is the pattern P included in text T?
What is a k-mer
a string of k characters S[5,8] = 4mer
What is a hash table?
A hash table is a data structure that enables efficient data retrieval by mapping keys to corresponding values through a hash function. It achieves constant-time average complexity for basic operations, such as insertion, deletion, and lookup, by using the hash function to index and organize the data.
What is the Z-algortihm?
The Z-algorithm is a linear time string matching algorithm that efficiently finds all occurrences of a pattern within a text. It constructs a Z-array, where each element at index i represents the length of the longest substring starting from position i that matches the prefix of the text. This array allows for pattern matching in O(n + m) time complexity, where n is the length of the text and m is the length of the pattern. O = (n)
What is a tree?
A tree T is a set of ≥ 1 nodes containing one special node designated the root of the tree. All nodes except for the root are partitioned into m ≥ 0 disjoint sets, T1,T2, …, Tm , each forming a subtree of the root.
What is a label?
Letters written along branches of the tree
What is a path?
a sequence of subsequent branches
What is a path label?
sequence of letters along a path
Where does a path start?
At the root of the tree
How to pre-process patterns?
keyword tree
What is big O of alignment via exhaustive enumeration?
O(e^n)
How to pre-process text?
suffix tree
What is the Needelmann wunsch algortihm?
The Needleman-Wunsch algorithm is a dynamic programming algorithm used for sequence alignment of two biological sequences, such as DNA, RNA, or protein sequences. It finds the optimal alignment by assigning scores to matches, mismatches, and gaps, aiming to maximize the overall similarity between the sequences.
What is Big O of alignment via matric?
O(n*m)
What is a global alignment?
Aligning both sequences in their entierty
What is Big O of Smith Watermann?
O(n*m) quadratic scaling instead of exponential