# on 11-Oct-2018 (Thu)

#### Flashcard 3415916809484

Question
In python, why would you use the array datatype (from the array module) instead of a simple list?
If you are dealing with an array of all items of the same type (e.g. all ints) and you want to save space/memory.

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3415935421708

Question
In regular expressions, the [...] charactor signifies exactly one of any charactors except line break (e.g. a [...] c matches abc, adc, etc)
"."

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
hat any character can take its place. This is said to be a wildcard and works with file names. With regular expressions, the wildcard to use is the . character. So, you can use the command grep <span>.3....8 <filename> to find the seven-character telephone number that you are looking for in the above example. Regular expressions are used for line-by-line searches. For instance,

#### Flashcard 3415939091724

Question
In Linux, if you are doing a file search with grep, how do you make sure you are searching for whole word only, "this" in file test.txt (i.e. "this is it" line will match but "thisis is it" will not")?
grep -w 'this' test.txt

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
ne line at a time. Here are some regular expression examples that will teach you the regular expression basics. We use the grep command to show the use of regular expressions (remember that the <span>-w option matches whole words only). Here the expression itself is enclosed in ' quotes for reasons that are explained later. grep -w 't[a-i]e' Matches the words tee , the , and tie . The

#### Flashcard 3415941713164

Question
In regular expressions, how do you search for a match for whole word starting with "a", followed by any single letter from "b" to "d", followed by "g"? (use grep to search for this pattern in file test.txt)
grep -w 'a[b-d]g' test.txt

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
that the -w option matches whole words only). Here the expression itself is enclosed in ' quotes for reasons that are explained later. grep -w 't[a-i]e' Matches the words tee , the , and tie . <span>The brackets have a special significance. They mean to match one character that can be anything from a to i . grep -w 't[i-z]e' Matches the words tie and toe . grep -w 'cr[a-m]*t' Matches the words craft , credit , and cricket

#### Flashcard 3415942761740

Question
In Linux, grep stands for [...] and is a tool to search, line by line, in a file for string matches.
global regular expression print

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
more personal. Regular expressions allow for this type of searching and replacing. 5.1 Overview Many utilities use the regular expression to give them greater power when manipulating text. The <span>grep command is an example. Previously you used the grep command to locate only simple letter sequences in text. Now we will use it to search for regular expressions. In the previous chapter

#### Flashcard 3415948791052

Question
In regular expressions, search for whole words that start with "a", followed by zero or more chars between "d" to "g", and end with "z" (use grep as example to search in file test.txt)?
grep -w 'a[d-g]*z' test.txt
^^ note the * that comes right after [d-g]

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
, the , and tie . The brackets have a special significance. They mean to match one character that can be anything from a to i . grep -w 't[i-z]e' Matches the words tie and toe . grep -w 'cr[a-m]<span>*t' Matches the words craft , credit , and cricket . The * means to match any number of the previous character, which in this case is any character from a through m . grep -w 'kr.*n' Matc

#### Annotation 3415953247500

 The team behind the Sokal 2.0 hoax self-consciously targeted what they call “grievance studies.” What ties all their targets together? My preferred answer is that grievance studies embrace both antipathy and self-pity. Or to be more precise, each of these fields intellectually justifies both:

Right-Wing Grievance Studies – Econlib
018 feminism, grievance studies, Sokal 2.0 Browse by Topic Browse by Author Search EconLog RSS Feeds Blogger Bios < Prev Next > Right-Wing Grievance Studies 24 By Bryan Caplan SHARE POST: <span>The team behind the Sokal 2.0 hoax self-consciously targeted what they call “grievance studies.” What ties all their targets together? My preferred answer is that grievance studies embrace both antipathy and self-pity. Or to be more precise, each of these fields intellectually justifies both: Antipathy for a large, unselective group. Encouragement of self-pity for the alleged victims of the aforementioned large, unselective group. Feminism, for example, normally combines ant

#### Flashcard 3415955344652

Question
In regular expressions, using grep, match for the words kremlin, krypton, krn, krzn, in file test.txt?
grep -w 'kr.*n' test.txt
^^ note the use of "." followed by "*" to search for 0 or more of any char

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
-w 'cr[a-m]*t' Matches the words craft , credit , and cricket . The * means to match any number of the previous character, which in this case is any character from a through m . grep -w 'kr.*n' <span>Matches the words kremlin and krypton , because the . matches any character and the * means to match the dot any number of times. egrep -w '(th|sh).*rt' Matches the words shirt , short , and thwart . The | means to match ei

#### Flashcard 3415958490380

Question
In Linux, the [...] character has different usage in file path matching vs grep, as in file path mathing it does NOT have to be preceded by another char like "." but in grep it does have to be.
"*"

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
any number of the previous character, which in this case is any character from a through m . grep -w 'kr.*n' Matches the words kremlin and krypton , because the . matches any character and the <span>* means to match the dot any number of times. egrep -w '(th|sh).*rt' Matches the words shirt , short , and thwart . The | means to match either the th or the sh . egrep is just like grep

#### Flashcard 3415965306124

Question
In regular expressions, what is the difference between square brackets "[]" vs round brackets "()"?
Square brackets means one of serveral charactors (e.g. [a-e]) whereas round brackets means one of serveral words (e.g. (the|this) )

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
e is any character from a through m . grep -w 'kr.*n' Matches the words kremlin and krypton , because the . matches any character and the * means to match the dot any number of times. egrep -w '<span>(th|sh).*rt' Matches the words shirt , short , and thwart . The | means to match either the th or the sh . egrep is just like grep but supports extended regular expressions that allow for the |

#### Flashcard 3415968451852

Question
In regular expressions, using grep, search for words that start with "sh" or "th" and end in "rt" (e.g. shirt, short, and thwart) in document test.txt?
grep -w '(sh|th).*rt' test.txt
^^ note the use of "|" for or, and the use of round brackets for matching words.

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
thwart . The | means to match either the th or the sh . egrep is just like grep but supports extended regular expressions that allow for the | feature. [ The | character often denotes a logical <span>OR , meaning that either the thing on the left or the right of the | is applicable. This is true of many programming languages. ] Note how the square brackets mean one-of-several-character

#### Flashcard 3415971597580

Question
In regular expressions, using grep, match for words that start with "thr", followed by zero or more vowels, and ending in t (e.g. threat and throat) in file test.txt?
grep -w 'thr[aeiou]*t' test.txt
^^ not the use of [aeiou] to match for any one of the included chars that are vowels

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
ble. This is true of many programming languages. ] Note how the square brackets mean one-of-several-characters and the round brackets with | 's mean one-of-several-words. grep -w 'thr[aeiou]*t' <span>Matches the words threat and throat . As you can see, a list of possible characters can be placed inside the square brackets. grep -w 'thr[^a-f]*t' Matches the words throughput and thrust . The ^ after the first bracket mea

#### Flashcard 3415974743308

Question
In regular expressions, using grep, match for all words that start with "the", followed by zero or more non-vowels, and ending in "t" (e.g. "theft" matches but "theit" does not), in file test.txt?
grep -w 'the[^aeiou]*t' test.txt
^^ note the use of "^" char to match for all chars except vowels

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
| 's mean one-of-several-words. grep -w 'thr[aeiou]*t' Matches the words threat and throat . As you can see, a list of possible characters can be placed inside the square brackets. grep -w 'thr[<span>^a-f]*t' Matches the words throughput and thrust . The ^ after the first bracket means to match any character except the characters listed. For example, the word thrift is not matched bec

#### Flashcard 3415977889036

Question
In regular expressions, using grep, search for all lines that begin with the word "The", in file test.txt
grep '^The' test.txt
^^ note the use of "^", also accaptable is: grep ' *^The' test.txt, this is to cover leading whitespace

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
and sometimes you would like to match a line that begins or ends with a certain string. The ^ character specifies the beginning of a line, and the $character the end of the line. For example, <span>^The matches all lines that start with a The , and hack$ matches all lines that end with hack , and '^ *The.*hack *$' matches all lines that begin with The and end with hack , even if there #### Flashcard 3415981034764 Question In regular expressions, using grep, search for all the lines that end with the word "hack" (may be followed by some whitespace), in file test.txt? Answer grep 'hack *$' test.txt
^^ note the use of $, also note the " *" do count for whitespace status measured difficulty not learned 37% [default] 0 5. Regular Expressions begins or ends with a certain string. The ^ character specifies the beginning of a line, and the$ character the end of the line. For example, ^The matches all lines that start with a The , and <span>hack$matches all lines that end with hack , and '^ *The.*hack *$' matches all lines that begin with The and end with hack , even if there is whitespace at the beginning or end of the line. B

#### Flashcard 3415984180492

Question
In regular expressions, for example using grep, 'myfile.txt' will match both "myfileqtxt" and "myfile.txt", how do you make it just match "myfile.txt"?
grep 'myfile\.txt'
^^ i.e. use the escape char "\" before the special char "."

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
. character. To match a . you can use the sequence \. which forces interpretation as an actual . and not as a wildcard. Hence, the regular expression myfile.txt might match the letter sequence <span>myfileqtxt or myfile.txt , but the regular expression myfile\.txt will match only myfile.txt . You can specify most special characters by adding a \ character before them, for example, use \[ for an actual [ ,

#### Flashcard 3415987326220

Question
In Linux, if you want to search in files and use regex features such as (+ ? \< \> ( ) | ) characters, you must use the [...] flag of grep
-E
^^ -E is short for --extended-regexp, note that grep -E is same as egrep (depricated)

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
matches any character and the * means to match the dot any number of times. egrep -w '(th|sh).*rt' Matches the words shirt , short , and thwart . The | means to match either the th or the sh . <span>egrep is just like grep but supports extended regular expressions that allow for the | feature. [ The | character often denotes a logical OR , meaning that either the thing on the left or the

#### Flashcard 3415991258380

Question
In Linux, if you want to just search for string literals in a file and not have to worry about using the "\" escape character, you can use the [...] flag of grep
-F
^^ -F is short for --fixed-strings, and is same as fgrep (depricated)

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
re them, for example, use \[ for an actual [ , a \$for an actual$ , a \\ for and actual \ , \+ for an actual + , and \? for an actual ? . ( ? and + are explained below.) 5.2 The fgrep Command <span>fgrep is an alternative to grep . The difference is that while grep (the more commonly used command) matches regular expressions, fgrep matches literal strings. In other words you can use fgr

#### Flashcard 3415994404108

Question
In regular expressions, using grep, search for lines that have words that end with 100 "i"s, in file test.txt (do it in easy way without typing in 100 "i"s)?
grep -w '.*i\{100\}' test.txt
^^ note the i\{100\}

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
. You can specify other ranges of numbers of characters to be matched with, for example, x\{3,5\} , which will match at least three but not more than five x 's, that is xxx , xxxx , or xxxxx . <span>x\{4\} can then be used to match 4 x 's exactly: no more and no less. x\{7,\} will match seven or more x 's--the upper limit is omitted to mean that there is no maximum number of x 's. As in a

#### Flashcard 3415997549836

Question
In regular expressions, using grep, search for all lines in file test.txt that have words that end with 5 to 10 "i"'s?
grep -w '.*i\{5,10\}' test.txt
^^ note the i\{5,10\} syntax

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
rs with \ . 5.3 Regular Expression \{ \} Notation x* matches zero to infinite instances of a character x . You can specify other ranges of numbers of characters to be matched with, for example, <span>x\{3,5\} , which will match at least three but not more than five x 's, that is xxx , xxxx , or xxxxx . x\{4\} can then be used to match 4 x 's exactly: no more and no less. x\{7,\} will match s

#### Flashcard 3416000695564

Question
In regular expressions, using grep, search for all lines in a file test.txt, that have words ending with 7 or more vowels?
grep -w '.*[aeiou]\{7,\}' test.txt
^^ note the syntax \{7,\}

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
with, for example, x\{3,5\} , which will match at least three but not more than five x 's, that is xxx , xxxx , or xxxxx . x\{4\} can then be used to match 4 x 's exactly: no more and no less. <span>x\{7,\} will match seven or more x 's--the upper limit is omitted to mean that there is no maximum number of x 's. As in all the examples above, the x can be a range of characters (like [a-k] )

#### Flashcard 3416005414156

Question
In regular expressions, the [...] charactor represents one or more occurences of something (as opposed to * being 0 or more occurances of something).
+

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
tion with egrep An enhanced version of regular expressions allows for a few more useful features. Where these conflict with existing notation, they are only available through the egrep command. <span>+ is analogous to \{1,\} . It does the same as * but matches one or more characters instead of zero or more characters. ? is analogous to \{1\}. It matches zero or one character. \< \&

#### Flashcard 3416008559884

Question
In regular expressions, the [...] charactor represents 0 or 1 occurences of something.
?

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
ith existing notation, they are only available through the egrep command. + is analogous to \{1,\} . It does the same as * but matches one or more characters instead of zero or more characters. <span>? is analogous to \{1\}. It matches zero or one character. \< \> can surround a string to match only whole words. ( ) can surround several strings, separated by | . This notation wi

#### Flashcard 3416011705612

Question
In regular expressions, what syntax do you use to match whole words (this is an alternative to the grep -w flag)?
\<\>

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
egrep command. + is analogous to \{1,\} . It does the same as * but matches one or more characters instead of zero or more characters. ? is analogous to \{1\}. It matches zero or one character. <span>\< \> can surround a string to match only whole words. ( ) can surround several strings, separated by | . This notation will match any of these strings. ( egrep only.)  can surround seve

#### Annotation 3416021142796

 een working on ways to surf like an absolute champ with features like Firefox Advance,” said Mark Mayo, Chief Product O

Pocket’s reading app won’t sound so robotic now – TechCrunch
e. The redesign includes updated typography and fonts, focused on making long reads more comfortable, as well. “At Mozilla, we love the web. Sometimes we want to surf, and the Firefox team has b<span>een working on ways to surf like an absolute champ with features like Firefox Advance,” said Mark Mayo, Chief Product Officer at Firefox, in a statement about the launch. “Sometimes, though, we want to settle down and read or listen to a few great pages. That’s where Pocket shines, and the new Pocket mak

#### Flashcard 3416031366412

Question
In algorithms, the [...] algorithm involves breaking a problem into smaller independent sub problems, and then in some way combining the results to obtain a global solution.
divide and conquer

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416034774284

Question
In algorithms, [...] algorithm can be used when the problem can be devided into subproblems that overlap and where intermediate results are cached and can be used in subsequent operations.
dynamic programming

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416037920012

Question
In algorithms, [...] algorithms involve finding the best solution to a local problem in the hope that this will lead to a global solution (the classic example is applying it to the shortest path problem, where this approach always chooses the closest destination first).
greedy

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416041065740

Question
In algorithms, divide and conquer (and dynamic programming) algorithms often use [...]
recursion

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416044211468

Question
In algorithms, a recursive function has two types of cases: [...] , which tell the recursion when to terminate, and recursive case that calls itself while going towards the base case.
base case

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416048143628

Question
In algorithms, a recursive function has two types of cases: base cases, which tell the recursion when to terminate, and [...] cases that calls itself while going towards the base case.
recursive

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416051289356

Question
In algorithms, explain what is the base case of a recursive function?
It is the terminating case that solves the simplest sub problem of the recursion

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416054435084

Question
In algorithms, recursive funtions have a base case and a recursive case, the recursive case does two things, 1) it calls the function itself and 2) [...]
it moves the solution closer to the base case

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416057842956

Question
In algorithms, between recursion and iteration, which is more memory intensive (hint: the one that results in stack overflow if fails to terminate).
recursion

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416061775116

Question
In algorithms, between recurtion and iteration, which one is usually more processor intensive (hint: thing of case where it fails to terminate/is infinite)?
interation

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416064920844

Question
In algorithm, time complexity is measured in [...] notation
big-O
^^ FYI, O stands for Order-magnitude

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416068066572

Question
In algorithms, the big-O time complexity order from fastest to slowest is: [...] , O(logn), O(n), O(nLogn), O(n^2), O(n^3), O(2^n)
O(1)

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416071212300

Question
In algorithms, the big-O time complexity order from fastest to slowest is: O(1) , [...] , O(n), O(nLogn), O(n^2), O(n^3), O(2^n)
O(logn)

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416074358028

Question
In algorithms, the big-O time complexity order from fastest to slowest is: O(1) , O(logn), [...] , O(nLogn), O(n^2), O(n^3), O(2^n)
O(n)

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416078290188

Question
In algorithms, the big-O time complexity order from fastest to slowest is: O(1) , O(logn), O(n), [...] , O(n^2), O(n^3), O(2^n)
O(nLogn)

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416081435916

Question
In algorithms, the big-O time complexity order from fastest to slowest is: O(1) , O(logn), O(n), O(nLogn), [...] , O(n^3), O(2^n)
O(n^2)

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416083795212

Question
In algorithms, the big-O time complexity order from fastest to slowest is: O(1) , O(logn), O(n), O(nLogn), O(n^2), [...] , O(2^n)
O(n^3)

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416086940940

Question
In algorithms, the big-O time complexity order from fastest to slowest is: O(1) , O(logn), O(n), O(nLogn), O(n^2), O(n^3), [...]
O(2^n)

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416090086668

Question
In algorithms, appending to the end of a list, or looking up something in a dictionary by key, is of what big-O time complexity?
O(1)

status measured difficulty not learned 37% [default] 0

#### pdf

cannot see any pdfs

#### Flashcard 3416093232396

Question
In algorithms, what is the big-O time complexity of an algorithm that shrinks the input size in half on each iteration (e.g. finding an element in a sorted array)?