instruction
stringlengths
35
29.1k
I have recently studied the Myhill–Nerode theorem and while applying it to minimize these FSMs, I encountered a problem. Is it always the case that the final states should be grouped together because they are indistinguishable? In the first FSM below, if I group states (q3,q4) on 0, q3 reaches q4 and q4 reaches q4, bu...
In parallel computing, Amdahl's law is mainly used to predict the theoretical maximum speedup for program processing using multiple processors. If we denote the speed up by S then Amdahl’s law is given by the formula: S=1/((1-P)+(P/N) where P is the proportion of a system or program that can be made parallel, and 1-P i...
The exponential-time hypothesis posits that if $\mathsf{3SAT}$ has NO subexponential time algorithm (i.e. one in $\mathcal O(2^{o(n)})$), then $\mathsf{P}\neq \mathsf{NP}$. However, I am interested in the case that it does have such an algorithm. From posts such as this, it seems that simply finding such an algorithm...
I'm working on learning operating systems and I've come across a strange question that I don't know how to answer. The question is: Assuming a 1-KB page size, what are the page numbers and offsets for the following address references (provided as decimal numbers)? 21205 The notes and slides I have are very confusin...
Is the language consisting of the bitwise XOR of elements of two regular languages still a regular language? For example, consider $$L=\{ x \operatorname{xor} y \mid x \in A, y \in B, |x|=|y| \},$$ where $A$ and $B$ are both regular languages. Can I say that $L$ is also a regular language?
Given array A=[31, 40, 41, 16, 41, 58,20], min algorithm returns 16. Write an algorithm for finding the minimum element.
I am trying to prove the fact that every CFL is decidable, however I can't come to terms with what the statement exactly means. I know that generation of a particular string by a given CFG is a decidable problem. This means that we can design a TM that will definitely halt and tell us whether the given string is genera...
Suggest how to allocate and deallocate storage for elements within the hash table itself by linking all unused slots into a free list. Assume that one slot can store a flag and either one element plus a pointer or two pointers. All dictionary and free-list operations should run in O(1) expected time. Does the free list...
How would you convert decimal 0.0650 to 1.15 Q format 16-bit of course? I'm kinda stuck in this for 3 days, can someone kindly help me out in this
I am trying to construct a context-free grammar for the language $$ L = \{ w \in \{a,b,c\} \mid w \text{ contains an odd amount of } a \text{ and there are exactly two } c \}. $$ I am currently stuck with this and any help would be appreciated, thanks in advance!
The Regular Expression i am having trouble with is the following a(b|bcc*)*c. My main concern is what do i do with the c*? I can lay the rest of the diagram correctly (i think) but that part is beyond me. Any help would be great, thank you. What i have:
The alphabet is {0,1,+,=}. I think it is a regular language since i can construct the NFA, But i want to make sure Thanks
I am searching for an optimized way of doing the have the following scenario. With two classes: Wrapper and Child. My goal is to organize the child objects inside the Wrapper class based on some rules. Scenario class Wrapper { int id; List<Child> children; } class Child { int id; int score; } Child m...
What is the representation of -40 in a 8bit computer using 2's complement intiger?
Given a collection of sets $\{S_1, S_2, \dots, S_n\}$, find all the "reduced" intersections between those sets that yield the desired set $\{x\}$ as the result. A "reduced" intersection is defined as an intersection between sets where $S_i\cap S_j\cap \dots \cap S_k = \{x\}$, such that removing any one of the sets in t...
I have to solve this exercise: Given an unordered array $A[1], \ldots, A[n]$ of positive and negative integers, determine if there are two indices $i \neq j$ such that $A[i] + A[j] = 0$. Establish a lower limit to the problem using the decision tree technique. The solution should be $Ω(\log s(n))$, where $s(n)$...
I cannot understand the first paragraph of the proof, which comes from the known book Introduction to Algorithms, third-edition, and I consider it has some errors, could anyone help me check about it? Possible errors: It first prove the case $\text{height(x)=0},$ then it says "For inductive steps, consider a node $x$ ...
I am trying to find a context sensitive grammar for the type-1 language $L = \{a^ib^jc^k \mid 0 \leq i \leq j \leq k\}$ I can construct the first part with \begin{align*} S &\to aSbB \mid B \mid \epsilon\\ B &\to bB \mid \epsilon\\ \end{align*} but how do I continue from there? I tried \begin{align*} S &\to aSbBcC \mi...
I want to convert the number -29.375 to IEEE 745 16-bit floating point format. Here is my solution: The format of the floating point number is: 1 sign bit unbiased exponent in 4 bits plus a sign bit 10 bits for the mantissa plus the explicit 1 First, I realize that 29.375 = 29 + 3/8. Then realize that: ...
I am struggling with the below problem. Curious to hear any guidance. The Partition Problem is the following: $\textbf{Instance:}$ A multiset of numbers $S = \{a_1, a_2, \ldots , a_n \}$. $\textbf{Question:}$ Can $S$ be partitioned into two multisets $A$ and $B$ such that the sum of the numbers in $A$ is equal to the...
Given a set of weighted intervals, the weighted interval scheduling problem is to select a subset of the intervals such that none of the intervals in the subset overlap and the sum of their weights is maximized. This can be solved in linear time with dynamic programming or memoized recursion. Is there a version of this...
I'm reading some papers about Delivery Clustering to solve following generic problems: Given N orders (with its Pick-up and Drop location point) and M delivery-man (with his location). We are going to assign M' drivers (M' <= M) to handle that N orders. Each driver can handle some X orders (X >= 0, in case X = 0, driv...
Let's have expressions that are finite-sized trees, with elements of $\mathbb N$ as leaf nodes and the operations {$+,\times,-,/$, ^} with their usual semantics as the internal nodes, with the special note that we allow arbitrary expressions as the right-hand side of the exponentiation operation. Are the equality betwe...
I'm looking at the following explanation of monotonic queues and their applications in problem solving. Monotonic Queue Summary I have a reasonable understanding of this data structure and the problems described in the post. However, i'm struggling with the following "recurrence relation" Any DP problem where A[i] = mi...
I've got a work that has to do with networks, where each edge has a weight ($w\in(0,1)$) and some random set of nodes are 'infected'. I don't know which nodes are (or how many). The diffusion spread is according to linear threshold model (with some random threshold $\theta\in(0.3,0.5)$. I'm allowed to delete only $10\%...
I have found this question in a book. I could convert it into its equivalent DFA. But the problem is with the "reduced state" part. I think the answer given in the book is wrong. What would be the DFA with its reduced states? I am giving the converting steps for reference: The reduced DFA as given in the book: So, ...
Assuming that $L_a$ is a regular language and $\Sigma=\{0,1\}$, prove that the following languages are regular: $$L_1 = \{u \mid \exists v\in\Sigma^* \, uv \in L_a\}$$ $$L_2 = \{w \in \Sigma^* \mid \exists x \in L_a \, n_0(w) = n_0(x) \}$$ $$L_3 = \{uv \mid u \in L_a \text{ and } v \notin L_a^{R}\}$$ where $n_0(w)$ i...
I'm trying to figure out why ternary search trees are memory efficient. I have tried to read up on this, but all articles I find only state it's memory efficient compared to tries, but not why. I believe it has something to do with the middle node, and with its ability to handle duplicate keys in a better way than trie...
I read that if BB(n) did not grow faster than all computable sequences of integers, you could solve the halting problem and contradict Turing's theorem. I'm trying to figure out how you could specifically do this. One obvious possibility is to build an n-state Turing machine that looks for a solution to an undecidable ...
I came with this interesting question and could understand how did we get to this equation: $(k-1)2^h + k(2^{h-1}+1) \leq 2^{\lfloor\lg (n)\rfloor}$ But in the next step, it reached to the following step which I cannot understand. Please help me out in understanding this: $k\leq \frac{n+2^h}{2^{h+1}+2^h+1} \leq \frac{n...
When I was searching the publication list of some CS researchers, I sometimes saw them putting a ($\alpha-\beta$) or ($\alpha-\beta$ order) in front of the authors of a paper. What does this mean?
Is master theorem applicable for this example? $$T(n)= 8T \biggl(\frac{n-\sqrt n}4\biggr)+ n^2$$
I have a list of 25 points and their coordinates in a 512-dimensional space. I have 8 target points and 17 points I need to avoid (the 17 points to avoid also have differences in priority of how important it is to avoid them). I want to find the smallest number of clusters that group together the 8 target points (in gr...
All "nice" Complexity classes are closed under finite union and intersection. (By "nice" I mean ones with complete problems or leaf languages, e.g. P, NP, PSPACE, etc.) But such classes are not closed under infinite union and intersection. Why?
I am using a merge sort like algorithm. Each level of the tree has a different Big O runtime. The runtime as a whole can be represent as follows: $$O(\sum_{i=0}^{log(n)}2^{\frac{n}{2^i}} * 2^i)$$ I am trying to find the recurrence. Since this is like merge sort we can start with the classic 2T(n/2). However, I am unsur...
I had trouble formatting the summation symbols, so if anyone knows how to do it correctly feel free to edit. I just read the asymptomatic analysis chapter from CLRS. While the aggregation and potential method are clear to me, I thought I should do some extra practice with the accounting method. My goal was to prove tha...
In the context of compilers, what exactly is a loop variable (if there is a standard definition)? Every read/write make up for the loop variable, or only writes make them up? Or is it writes in the body and reads in the condition?
I have $n$ items and a bin of size $B$ units. Each item $j$ consumes $w_j$ units of $B$ when placed into the knapsack. The item appears one-by-one in an online fashion. Once item $i$ appears, we must either place it into the bin (irrevocably) or ignore it. The objective is to maximize the number of items placed into th...
So I am a bit confused about the reduction between SAT, subgraph isomorphism (SI) and graph isomorphism (GI). I know that GI is in NP, and that SI is NP-complete. So I'm thinking if we can decide instances of SAT in polynomial time, then we can also solve GI and SI in polynomial time since SAT is NP-complete and if one...
Suppose we have an origin centered circle, ie $x^2 + y^2 =1$, so it's in $\mathbb{R}^2$ (2D). It will be classified as 1 if it lies only on this arc, and will be labeled 0 otherwise. What is the VC dimension? I think the answer is 2. Any two points can be shattered $(++, -+, +-, --)$. But if we have three points $\{(x...
I have seen that the Subset Sum Problem can be solved using Dynamic programming and we should look up the Last row's last column to return the result. My questions are. How did someone conclude that the Last row's last column will give us the result? How can we trace from there to check the subset that can be added t...
I'm using Isabelle/HOL. Isabelle exports the last fact in a block, allowing the context that contains the block to use it. Ordinarily when I generate facts, I can give them convenient names. How do I name facts that are exported from blocks? Simple example: lemma mylemma: "i=i" proof - { fix j::nat hav...
Does the following approximation algorithm for vertex cover also have an approximation ratio of 2? Why? Why not? Input: $G = (V,E)$ Set $C \gets \emptyset$ and $E' \gets E$. while $E' \neq \emptyset$ do: Pick any edge $(u,v) \in E'$. $C \gets C \cup \{u\}$. Remove from $E'$ all edges incident to $u$. return $C$.
I am writing a function which XORs 32 boolean variables to produce a 32 bit output. To this end I have 32 lists of boolean variables (the lists have between 12 and 17 elements). Every variable in list 0 can be XOR'd together to produce bit 0 of the output. Every variable in list 1 can be XOR'd to produce bit 1 of the o...
minimax complexity has an upper bound complexity of o(b^m), where b are the legal moves in the game and m the depth of the search tree. For an unbounded tic-tac-toe search, the max depth would be 9, and the number of legal moves goes decreasing as the search deepens e.g. at depth 0 it's 9, at depth 1 8 and so on. Thus...
Applying entertainment with computations is my main motivation in studying Computer Science, however, I'm still a neophyte to this field. While searching across the net, I came across this paper Classic Nintendo Games are (Computationally) Hard, indicating that Mario is an NP-Hard problem. Given by the proof of NP-hard...
I would like to demonstrate that sometime radix-sort is better than quick-sort. In this example I am using the program below: #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <time.h> #include <math.h> int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)...
Assume $ \Sigma=\{0,1\}$, is $L$ a regular language? If it is not, how should we prove it with pumping lemma? $$L = \{1^{a_1} 0^{a_2}\ldots 01^{a_k} \mid k \in \mathbb N , a_i \geq 0 , \text{ the $a_i$ are all different}\} $$
I want to write a constraint with ORs in a MILP. In particular, the following: $$x \ge c \lor x \le -c \lor x=0,$$ where $c$ is just a real number. Can anyone give me some hints?
Wikipedia states that "On infinite graphs with a finite branching factor and edge costs that are bounded away from zero $ (d(x,y)>\varepsilon >0$ for some fixed $\varepsilon$), A* is guaranteed to terminate only if there exists a solution." Does this mean that, if I have such a graph, then there is no admissible A* whi...
If we have a sample dataset $S = \{(x_1, y_i),\dots,(x_n,y_n)\}$ where $y_i = \{0,1\}$, how can we tune $\sigma$ such that there is no error on $S$ from a classifier using the Laplacian kernel? Laplacian Kernel is $$ K(x,x') = \exp\left(-\dfrac{\| x - x'\|}{\sigma}\right) $$ If this is true, does it mean that if we ru...
I am trying to solve a house painting problem: There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color. The cost of painting each house with a...
The input space is a unit circle, $\mathcal{X} = \mathbb{S}^1 \subset \mathbb{R}^2$. There is class $\mathcal{F}$ of arcs on $\mathbb{S}^1$, where a point is labeled 1 if it is on the arc, and 0 otherwise. We want to find the VC dimension of $\mathcal{F}$ I think the answer is 2. Any two points can be shattered $(++, ...
I've read there are ways you can determine all reachable pairs using Strongly Connected Components. But, I want to calculate all reachable nodes on the fly - so I don't have to store a massive reachability matrix in RAM. What sort of time complexity would be possible for an algorithm to calculate all reachable nodes in...
Suppose we have a directed acyclic graph $G=(V,E)$, such that all vertices have a addible weight, e.g. there is a function $weight: V \to \mathbb{R} $. Moreover two vertices $v,w \in V$ are given and we write $G_{v,w}$ for the subgraph of $G$ that consists of all vertices and path between $v$ and $w$, both included. T...
void union_sets(int a, int b) { a = find_set(a); b = find_set(b); if (a != b) { if (size[a] < size[b]) swap(a, b); parent[b] = a; size[a] += size[b]; } } Q1.why we need this swapping? can't we do like this without swapping if (size[a] < size[b]) parent[a] =...
How are these two problems different? I. Find all paths between a source vertex and destination vertex. II. Find all paths between a source vertex and all vertices in the graph. Both of these problems are NP-hard. We would naturally assume (II.) takes longer. However, I believe we can use a flavor of (II.) to so...
This is more a formal language theory question. Imagine a setting where you are given a very basic programming language where variable assignments etc are taken care of without any of the iteration capabilities. The only iteration capability of this primitive language is having a for loop. I'm not sure if there is alre...
Let $G = (V_1,E_1)$ and $H=(V_2,E_2)$ are two graphs. It is given that $l_1$ many edges (known to us) of $G$ will map to $l_1$ edges of $H$ in any isomorphism of $G$ and $H$. If I remove $l_1$ edges of $G$ (keeping the end vertices) then new graph is $G'$ and graph obtained after removing $l_1$ edges (keeping the end v...
A strongly independent set of a graph $G'$ is a subset $S$ of vertices such that the distance in $G'$ between every two distinct vertices in $S$ is larger than $2$. It is possible to reduce an instance $\langle G, k\rangle$ of the decision version of independent set to an instance $\langle G', k\rangle$ of the decision...
I have n objects of independent size s, and need to group them so that the sum of the sizes of each group is smaller than a given maximum size, and the number of groups is the smallest possible. I already tried a brute force algorithm that orders the objects in all possible permutations and then, based on their size an...
Let: $ G = <V, \Sigma, R, S >: \\ V = \{ S,A,B,C \} \\ \Sigma = \{0, 1\} \\ R: \\ S \to CSC|A \\ A \to 0B1|1B0 \\ B \to CB|\epsilon\\ C \to 1|0 $ I need to find the language (no need to formally prove). I have written many words but cannot seem to find a rule. After trying that path I rewrote the grammar in a shorter ...
I have a basic question, if I can model a problem $(P)$ by a linear program, can we say that $(P)$ is polynomial? Linear programs can be solved using simplex, and it was proved that simplex run in exponential time for some instances, so why some references assume that linear programming is polynomial?
I am a Software Developer but I came from a non-CS background so maybe it is a wrong question to ask, but I do not get why logic gates/boolean logic behave the way they do. Why for example: 1 AND 1 = 1 // true AND true 1 OR 0 = 1 // true OR False 0 AND 1 = 0 // false AND true And so on.. Is it a conditional defi...
$$f(x) = x \tanh(\log(1 + e^x))$$ The function (mish activation) can be easily implemented using a stable log1pexp without any significant loss of precision. Unfortunately, this is computationally heavy. Is it possible to write a more direct numerically stable implementation which is faster? Accuracy as good as x * std...
I don't how this works. According to me if the physical memory is not cleared then there is some security risk as there may be some sensitive information in it from the other processes. How does the kernel take care of this?
I have an array of $n$ $m$-dimensional vectors (in my case, they're 27 dimensional). I also have an $m$-dimensional vector $s$. I want to find all combinations of $k$ vectors from my array whose vector sum is equal to $s$. How to do this efficiently? The best I could do is just a brute force which is $O(n^k)$ and impos...
Suppose we're designing a game like Minecraft where we have lots of items $i_1,i_2,...,i_n\in I$ and a bunch of recipes $r_1,r_2,...,r_m\in R$. Recipes are functions $r:(I\times\mathbb{N})^n\rightarrow I\times\mathbb{N}$, that is they take some items with non-negative integer weights and produce an integer quantity of ...
if it is executed on unconnected graphs what will it execute? I thought it won't execute since it is unconnected but since it is being implemented by min priority queue, will that affect the results?
Nvidia GPU can speed up the matrix manipulation greatly. I want to have a basic idea to predict the consumed time for matrix manipulation. How can I analyze the time complexity of matrix multiplication and inverse operation on a GPU?
At first, I believed since the state a halting configuration is at will be a halting state, whenever a configuration goes into that state, the TM halts. Hence, there should not exist two configurations that appear at a different time that have the same current state. However, after reading some introductions of the One...
There are two sets of integers with different numbers of items in them. X= { x_0, x_1, ... x_n }, x_0 < x_1 < ... < x_n Y= { y_0, y_1, ... y_m }, y_0 < y_1 < ... < y_m And there is a function of a single integer defined as F(delta) = CountOfItems( Intersection( X, { y_0+delta, y_1+delta, ... y_m+delta) ) ) That is -...
I have been studying quantum error correction codes and as background, I am currently studying the theory of classical linear codes. Despite many efforts, I am unable to understand the following excerpt: Any given parity check u divides Hamming space exactly in half,into those vectors which satisfy u and those that do ...
$$ \Theta - Tight \ asymptotic \ bound $$ If we change lines $5-7$ in Insertion sort With BINARY-SEARCH(A,p,r,v) Why don't we get a running time of $\Theta(n\lg n)$ as we go through the array $\Theta(n)$ and then do a binary search $\Theta(\lg n)$?
For my development purpose, I need to work on all the 2D coordinates (in whole number) around [0,0] from 0 to N distance. For example, with N=1, I need N0: [0, 0] N1: [-1, -1] [0, -1] [1, -1] [1, 0] [1, 1] [0, 1] [-1, 1] [-1, 0] The order is important. I want to walk these values in a circular way, starting from 0, in...
My basic setup is very simple: I'm trying to sort N items now, and later on I'll need to incrementally sort more items. The unique part of the problem is that my item comparison is not a computational process; it's a high-latency external task. But I can run several comparisons in parallel. As a result, the duration of...
As the question suggests, is there any interaction or relationships between any sort of software and the cpu during the fetch-execute cycle?
In this paper Claim 1 states that x and y are smallest probability and there is optimal code tree in which these two characters are siblings at the maximum depth. In proof to that claim, author starts with tree T which has b and c at the maximum depth of tree. I can't understand why tree T is called optimal, because if...
I'm trying to make a function that takes a string and compresses the repeating blocks. The code I'm using is implemented in such a way that a single character like 'a' would be converted to '1(a)' resulting in a bigger length. The code is something like this: import re def _format_so(bchars, brep): return '%i(%s)...
I already asked similar question here. However, now I restate the question. Let say that $P$ is an NP-hard optimization problem and $Q$ is a problem with unknown complexity. Additionally, we have an algorithm for solving problem $Q$. We can solve problem $P$ with input $x$ in the following manner: max = -inf - the ...
I am trying to unify two expressions given a unification algorithm $unify$ applied to the unification graph of the two expressions. However, I struggle a lot in understanding how exactly the steps of this algorithm is actually done - and my teacher failed to explain this in much detail. The following example is part of...
I'm having difficulty understanding the conversion from a multi-tape Turing Machine $M$ to a single-tape Turing Machine $S$. Suppose that $M$ has 3 tapes with input strings $w_1 = 0110$, $w_2 = aaba$, and $w_3 = XXXX$, and configurations $\textbf{0}110$ $aa\textbf{b}a$ $X\textbf{X}XX$, where the bold-faced symbols repr...
Given two B-trees of some order $m$ - $T_1,T_2$, such that $y > x$ for every pair $x \in T_1$ and $y \in T_2$. What is the fastest way to create a new tree that is the union of both $T_1,T_2$? My current solution is naive in a sense that I create an array and insert all $T_1$ elements, than all $T_2$ elements. As a re...
I'm wondering where the GUI terminology like modal dialogue comes from. Who first used these terms? Is there a paper or a book, or was it just sw?
Five Tuple Identifier of TCP connection is (TCP, local IP, local port, remote IP, remote port). I have made 3 computers in virtual box and set BOX1 for client, BOX2 for median, and BOX3 for server. And made interfaces between them to communicate. So I have executed the server program on BOX3 and client program in BOX1...
The transfer of control is often completed through some type of software interrupt instruction. These special instructions result in the CPU to save the current state of the machine and transfer control to a function in the operating system. They are like a cross between an ordinary subroutine call instruction and a ha...
I need to write a regular expression for the following set of strings on Σ = {a, b, c} in which the number of b’s is even, and contains abcba as a substring. So far, the even number of b's can be constructed using like this: (aUb(aUc)*bUc)* or (cUa)*b(cUa)*b(cUa)* to add the substring abcba, do I just attach it to ...
I was looking at an example here: https://blog.parasoft.com/finding-memory-leaks-in-c #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { char *string, *string_so_far; int i, length; length = 0; for(i=0; i<argc; i++) { length += strlen(argv[i])+1; string = malloc(...
We are given an array of weights $W$ (all weights are positive integers), and we need to put the weights inside bins. Each bin can hold a maximum of Max_val, and each weight is at most Max_val. The variation is that the ordering of weights should not be changed, that is, $W_i$ should be inside a bin before $W_j$ is ins...
In wiki, it is shown that the time complexity of matrix multiplication and matrix inverse is similar. But people always to argue it is easier to do matrix multiplication rather than inverse. Is this claim true? Maybe we need to consider various computation platform, CPU or GPU.
At the moment, I'm making a comparative analysis between two different neural networks for a class. The problem they are both trying to solve is detecting tables on documents. Below is an example of one: One of the algorithms I am analyzing is a fully convolutional network. The way the algorithm works is that it goes ...
Consider applications A1, A2 .. AN having properties P11, P12,... PN1, PN2.. Also consider buckets B1, B2 ... BN where each property needs to be mapped. We have the following constraints - total number of properties >> number of applications total number of properties >> number of buckets number of buckets ~= number...
For Dijkstra’s,i can find shortest paths from source to all vertices in the given graph but how can i calling the algorithm |V| times taking each vertex as a source and store all tables ??? For example : What is the shortest path from 1 to 4? You need to print the value and the exact path vertices starting from 1 and e...
I'm going through 'Operating Concepts' by Silberschatz, Galvin and Gagne (The Dinosaur Book) and it mentions the Second-Chance Algorithm (not enhanced) as an improvement on the FIFO replacement algorithm. My question is, is there ever a case where this algorithm would perform better than, say, the Least Recently Used ...
If space is of primary concern, how could we improve on adjacency matrices and adjacency lists for representing a graph of nodes and undirected edges in memory? Throughout academia we learn adjacency matrices and lists but in the real world we encounter graphs of sizes that exceed the capabilities of these representati...
I need help figuring out the runtime of the following pseudocode. I believe it is O(|E| + |V|), but I'm not totally sure... graphFunction(graph): q = Queue() for vertex in graph: q.enqueue(vertex) while q is not empty(): v = q.dequeue() for every outgoing edge of v: ...
I just answered this question on StackOverflow, which asks for an efficient algorithm such that given a nonempty hashtable, the algorithm should return a pointer to an arbitrary nonempty entry in the hashtable. My answer was quite casual and I am not confident if my proof was correct. I am rephrasing the problem statem...
How to check if $L = \{c^ka^nb^n \mid k>0 \wedge n\geqslant0\} \cup \{a, b\}^*$ is regular ,where $L_1 = \{c^ka^nb^n \mid k > 0 \wedge n\geqslant0\}$ is clearly not regular and $L_2 = \{a, b\}^*$ is... ?
If an array $A[1 \ldots N]$ is represented using a segment tree having sets in each interval, why does a range query $[L\ldots R]$ returns at most $\lceil \log_2{N} \rceil$ sets (or disjoint intervals)? If came across this statement while reading this answer. To quote: Find a disjoint coverage of the query range using...
I'm writing my thesis and i have built a RPI cluster, containing 10 nodes which consists of RPI model 3b. I've them connected to two gigabit switches. I don't know the CAT of the cables. They are not connected to the Internet, they just live in their private network. Further more, i've calculated the theoretical perfo...