Rubelito Abella

@RubAbella

Joined on Sep 22, 2017

  • Answer: ca is true since given any pair of vertices $v_k$ and $v_l$ where $k \neq l$, either $k < l$ or $l < k$. This implies that ${v_k,v_l} \in E$ or ${v_l,v_k} \in E$, which mean the same thing since ${v_k,v_l} = {v_l,v_k}$. Therefore this means that for any pair of vertices, there exists an edge that connects said pair. This is the definition of any complete graph. b is also true since any complete graph is connected. This means that the answer is c. Answer: ashortest paths:${v_1,v_5 },{v_5,v_3 }$ with a path length of 3, ${v_2,v_1 },{v_1,v_4 }$ with a path length of 5, ${v_4,v_1 },{v_1,v_5 },{v_5,v_3 }$ with a path length of 6, Answer: c I is not true since $v_1$ and $v_5$ have an odd degree. But since these two are the only vertices with odd degrees, it has an Euler path making II true. If ${v_1,v_5}$ is removed from the graph then all edges will have an even degree making III true. Answer: b
     Like  Bookmark
  • A lot of structures in mathematics and computer science can be characterized by complex connections and relationships. These structures are intimately known to computer scientists as graphs and trees. Graphs A graph commonly denoted as $G=(V,E)$, where $V$ is a nonempty set of vertices (sometimes called nodes) and $E$ is a set of edges. Each edge connects two vertices in $V$. An example is a transportation network that is represents cities as vertices and roads as edges: $V$={"Whiterun", "Falkreath","Solitude", "Markarth", "Morthal", "Dawnstar", "Winterhold", "Windhelm", "Riften"} $E$={{"Whiterun", "Falkreath"}, {"Whiterun", "Morthal"}, {"Falkreath","Markarth"}, {"Falkreath", "Solitude"}, {"Morthal", "Windhelm"}, {"Morthal", "Dawnstar"}, {"Dawnstar", "Winterhold"}, {"Windhelm", "Riften"}}
     Like 1 Bookmark
  • Show your solutions figure Provide one Euler circuit from graph G. In graph G, what is the shortest distance from b to d? The requirements for a graph to contain an Euler circuit are that (1) the graph must be connected, (2) every vertex must have an even degree. What are the requirements for it to have an Euler path?
     Like  Bookmark
  • Show your solutions. Suppose you're rolling two fair dice, and flipping two fair coins, arrange the following outcomes from least likely to most likely (for each letter, write down the sample space and event space):a. The sum of dice rolls are 6 and there are two heads.b. Neither of the dice rolls exceed 2* and the two coins have the same outcome.c. At least one dice roll is even and the two coins are tails *each individual die roll is not greater than 2 Which of the following pairs of events are independent?a. $E$: Rolling a number greater than 3 on a dice, $F$: rolling an even number on the same dice roll,b. $E$: Flipping tails on a coin flip, $F$: flipping heads on the same coin flip,c. $E$: Flipping two heads from three coins flips, $F$: flipping two tails from the same three coin flips.
     Like  Bookmark
  • Counting Principles Show your solutions If a procedure can be broken down into $n$ tasks, where each task $i$ can be performed $t_i$ ways. Prove via induction that the procedure $P_n$ can be performed $t_1t_2 \cdots t_n$ ways. How many 4-element DNA sequencesa) do not contain the base T?b) contain all four bases A, T, C, and G?c) contain exactly three of the four bases A, T, C, and G? A palindrome is a string whose reversal is identical to the string. How many bit strings of length n are palindromes? Permutations and Combinations Show your solutions
     Like  Bookmark
  • What to bring Blue book Pens Clean scratch papers (optional, you can write your solutions on the blue book) Coverage and Competencies Asymptotic Analysis Evaluating asymptotic relationships based on graphs Evaluating asymptotic relationships based on asymptotic notation properties Reducing complex functions to representative functions
     Like  Bookmark
  • Deadlines: Section B - 26 Feb 2024 Section C - 26 Feb 2024 Draw the following vectors, in the Cartesian plane $$ \vec{p}=\begin{bmatrix} 2\3
     Like  Bookmark
  • Proof that $\frac{\sqrt{n+2}}{\log_2{n}} \in \Omega{(\log_4{(\log_2{n})})}$​ If we keep on applying LHR to prove this, we will end up expanding the ratio more an more. Instead we will solve this in multiple steps. First we establish that the fraction $\frac{\sqrt{n+2}}{\log_2{n}}$ is more complex than $\log_2{n}$. By solving the limit we find: $$ \begin{aligned} \lim_{n \to \infty}{\frac{\frac{\sqrt{n+2}}{\log_2{n}}}{\log_2n}} &= \lim_{n \to \infty}{\frac{\sqrt{n+2}}{(\log_2{n})^2}}\ \end{aligned} $$
     Like  Bookmark
  • Introduction As procedural programming became more and more mainstream, computer scientists started to notice the issues behind states and side effects. Some languages offered a complete paradigm shift, completely abandoning the notion of state. This exodus formed the alternative paradigm family, declarative paradigm. Other languages however, went on a different direction. These languages offered a solution to fixing state by introducing richer features and an intuitive design. From this approach the paradigm object oriented programming was born. Learning Outcomes After this discussion you should be able to Explain how programmer's started to focus on writing maintainable code Differentiate between the object and the class Explain OOP's philosophy, the surface vs. the volume Explain what abstraction means
     Like  Bookmark
  • Counting If you happen to have zero background on what we are going to talk about in this series of topics, you might find it strange how a college course in computer science teaches you about counting. Although this lecture is indeed related to the concepts of cardinality, (how many things are there), we instead go deeper into slightly more complicated "how many" questions. Basic Rules of Counting Counting combinations of related things become more interesting. Suppose you have a two disjoint sets of things called $A$ and $B$, how do you count the number of unique combinations of the elements of $A$ and $B$? The Product Rule Given a procedure with two tasks, if there are $n_1$ ways to perform the first task and $n_2$ ways to perform the second task, then there are $n_1 n_2$ ways to perform the whole procedure. For example, let $A={a,b,c,d}$, $B={x,y,z}$, if you list down all of the possible combinations this way:
     Like  Bookmark
  • $i(n)$, $f(n)$, $g(n)$, $j(n)$, note that $g(n) \in \Theta(j(n))$​To solve this you sometimes need to use the limit definition for the compound functions.$f(n)$ is quadratic, $g(n)$ is exponential $i(n)$ is logarithmic (find the most complex term using the limit definition) $j(n)$ is exponential You'll also find that after applying change of base to the exponential functions, they are the same function. Only choice b is true $$
     Like  Bookmark
  • Arrange the following functions from least complex to most complex, also write which functions are equally complex (if applicable)$f(n)=n^2 -2n$ $g(n) = 4^{2n}$ $i(n) = (\log_4 n) +\sqrt{log_4 n}$ $j(n) =2^{4n}$ Given $f(n) \in o(g(n))$, which of the following relationships are true: a. $f(n)g(n) \in o(f(n))$ b. $f(n)g(n) \in \omega(f(n))$
     Like  Bookmark
  • Matrices and Matrix Operations A matrix is a rectangular collection of numbers. The matrix below called matrix $A$ is a $2 \times 3$ matrix. Meaning it has 2 rows and 3 columns. $$ A=\begin{bmatrix} 4&2&-3 \ 11&\pi & 12 \end{bmatrix} $$
     Like  Bookmark
  • Deadlines Section A - 9 Feb 2024 Section B - 12 Feb 2024 Section C - 12 Feb 2024 Which complexity classes do these functions belong to? Write the complexity class in terms of $\Theta$. $3n^2+40n-5$ $8n+6n+log_3n$ $log_5 n + 6 log_3 n$
     Like  Bookmark
  • Given the following matrices: $$ A=\begin{bmatrix} 1&-1&-2\ 2&3&-1\ -2&1&2 \end{bmatrix}, B=\begin{bmatrix} 2&0\ -1&0\
     Like  Bookmark
  • Given the following pair of functions, choose all asymptotic relationships that apply ($O(g(n)), \Omega(g(n)), \Theta(g(n))$). $f(n) = n^2 + 2$, $g(n) = 2n^3$ $f(n) = 10n + 2$, $g(n) = n^2 + 1$ $f(n) = 5\log_2 n + 2$, $g(n) = n+3$ $f(n) = n\log_2 n + 2$, $g(n) = 2n^2+n$ $f(n) = 2^n$, $g(n) = 5n^5$ $f(n) = \log_2 n$, $g(n) = \sqrt{n +2}$ $f(n) = \frac{\sqrt{n +2}}{(\log_2 n)}$, $g(n) = \log_4 {(\log_2 n)}$
     Like  Bookmark
  • The way we're going to approach this topic is by getting directly into the definitions and mechanics. You might not be able to immediately appreciate the reason why we are discussing these mathematical constructs. They seem very unusual and appear to have nothing to do with computer science. But rest assured that at the end of this topic I will be discussing the application of these particular constructs in computer science. In fact, the reason why I decided to put this topic right at the start of the semester is because this topic is up there with the most important things you need to master as computer scientists. As you mature as computer scientists you'll be able to apply these mathematical constructs from automatically, as if it's muscle memory. You are going to spend a couple of weeks to master these concepts. We're doing this so that you'll start your growth as computer scientists with strong mathematical and theoretical foundations. Formal Definitions We'll jump right in with the formal definition of the constructs known as Big-O (Big-O), Big-$\Omega$ (Big-Omega), and Big-$\Theta$ (Big-Theta). Big-O $$ O(g(n))={f(n)| \exists c>0,n_0>0(\forall n>n_0 (0 \leq f(n) \leq cg(n))) } $$
     Like 1 Bookmark
  • Task Looking back at our previous lab exercises, some of the example classes contain string representation but do not implement the __str__() function. An example of this is Shipment back from the factory method example. It does contain a string representation builder called shipmentDetails(), but printing a shipment is quite tedious since you have to print, s.shipmentDetails(). You can replace the name of shipmentDetails() to __str__() but this will potentially affect other clients of shipment. You can add the __str__() function which does exactly the same but this may introduce unwanted code duplication. from abc import ABC,abstractmethod from datetime import date,timedelta class Delivery(ABC): @abstractmethod def deliveryDetails(self) -> str: pass
     Like  Bookmark
  • Task A sentence can be defined as a list of words (words are strings). The string representation of a sentence is the concatenation of all of the words in the list, separated by a space. from abc import ABC,abstractmethod class Sentence: def __init__(self,words:[str]): self.__words = words def __str__(self) -> str:
     Like  Bookmark
  • Task For non built-in collections, you can create an iterator that does the traversal for you. On the bare minimum these iterators will realize some Iterator abstraction that contains the methods, next(), and hasNext(). From these methods alone you can easily perform complete traversals without knowing the exact type of the collection: i = collection.newIterator() while i.hasNext(): print(i.next()) iterator from abc import ABC,abstractmethod
     Like  Bookmark