Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Question

In linux, regular expression **[...]** , marked via the enclosing** **escaped-round-bracket syntax, group parts of a regular expression together, so they can be swapped or just displayed in chuncks via sed, for example.

Answer

subexpressions

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

g text around within lines. Consider, for example, the output of ls : say you want to automatically strip out only the size column-- sed can do this sort of editing if you use the special \( \) <span>notation to group parts of the regular expression together. Consider the following example: sed -e 's/\(<[^ ]*>\)\([ ]*\)\(<[^ ]*>\)/\3\2\1/g' Here sed is searching for the expression \<.*\>[ ]*\<.*\> . From the chapter

Question

In python/algorithms, what is the time complexity of index lookup/assignment for lists (e.g. you have l = [1,2,3,4,5], what is big-O of doing: l[2] = 0)?

Answer

^^ the reason it is O(1), is because doing delete via pop(i) is O(n) as a python tradeoff to make index assignment faster.

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Question

In python/algorithms, what is the time complexity of append for lists (e.g. you have l = [1,2,3,4,5], what is big-O of doing: l.append(6))?

Answer

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Question

In python/algorithms, what is the time complexity of pop() for lists (e.g. you have l = [1,2,3,4,5], what is big-O of doing: l.pop()?

Answer

O(1)

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Question

In python/algorithms, what is the time complexity of pop(i) for lists (e.g. you have l = [1,2,3,4,5], what is big-O of doing: l.pop(0)?

Answer

^^ this is python sacrifice to make index assignment O(1)

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Question

In python/algorithms, what is the time complexity of insert(i,item) for lists (e.g. you have l = [1,2,3,4,5], what is big-O of doing: l.insert(1,7)?

Answer

O(n)

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Question

In python/algorithms, what is the time complexity of concatination for lists, where original list length is n, and the length of list being concatinated is k?

Answer

O(k)

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |