Lecture 1 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is the Sieve of Erathotenes

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is insertion sort?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an algorithm?

A

Finite: Must terminate
correct: must yield correct solution
efficient: should scale polynomically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is merge Sort?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is exhaustive search?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is binary search?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When would binary search not work?

A

When you have multiple answeres in the list you are searching for

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is injective?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is bijective?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is surjective?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How many bijective mappings between two sets with
|A| = |B| = n exist?

A

n!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How many injective mappings between two sets with |A| = n
and |B| = k, n ≤ k, exist?

A

C(k,n)= k! / (n!(k−n)!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the Hungarian Algortihm?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the Time complexity of pattern matching via Naive search?

A

O (m*n) m = length of pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the traveling salesman problem?

A

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!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is set matching by brute force time complexity?

A

n! elements are sorted in a time complexity of O = ((n!)log((n!)))

16
Q

What is pattern matching?

A

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?

17
Q

What is a k-mer

A

a string of k characters S[5,8] = 4mer

18
Q

What is a hash table?

A

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.

19
Q

What is the Z-algortihm?

A

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)

20
Q

What is a tree?

A

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.

21
Q

What is a label?

A

Letters written along branches of the tree

22
Q

What is a path?

A

a sequence of subsequent branches

23
Q

What is a path label?

A

sequence of letters along a path

24
Q

Where does a path start?

A

At the root of the tree

25
Q

How to pre-process patterns?

A

keyword tree

26
Q

What is big O of alignment via exhaustive enumeration?

A

O(e^n)

26
Q

How to pre-process text?

A

suffix tree

27
Q

What is the Needelmann wunsch algortihm?

A

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.

28
Q

What is Big O of alignment via matric?

A

O(n*m)

29
Q

What is a global alignment?

A

Aligning both sequences in their entierty

30
Q

What is Big O of Smith Watermann?

A

O(n*m) quadratic scaling instead of exponential