instruction
stringlengths
35
11.4k
I don't know if this is the right place to ask this, but here goes: I have a set of players in 3 age groups. Each player has the attributes: gender mental skill (1-10) physical skill (1-10) age group (1-3) I want to sort them into 14 teams that have balanced "stats", as in each team has (or as close as possible): s...
Consider an un-weighted directed acyclic graph (DAG) consists of m source (root) vertices and n target vertices. When there is only one source vertex (m=1), the problem to find a directed path connecting a maximal number of target vertices is the longest path problem in a DAG, which can be optimally solved within linea...
So If I understood correctly, the conversion from 4-SAT statement to 3-SAT statement follows the following approach: (a or b or c or d) -> (a or b or z) and (-z or c or d) Where the z is a new literal. However, with 4 literals there exists 4^2 different permutations (a or b or c or d) and (-a or b or c or d) and (a or ...
I'm confused about this exercise. We have assembly code: 01: ADDI $1, $0, 1000 02: LW $2, 0($1) 03: BEQ $0, $0, LABEL 04: MULT $3, $2 05: ADDI $2, $2, 1000 LABEL: 06: MFLO $4 07: ADDI $2, $1, 5 08: SW $2, 0($1) 09: NOP with: - 6-stages Pipeline - Branch Delay Slot - No Bypassing Is this correct? D...
I am trying to get a better understanding of Fibonacci Heaps. I noticed the following definition for the potential function. $$ \Phi(F)=|W| +2\cdot \text{# marks}. $$ I do not understand why it is defined that way, or what its significant is. I am hoping somebody can explain it to me.
I have to prove that the following language is not regular: $$\{ x | x = 10^{2n} + 10^n + 1, n ≥ 1\}$$ I am trying to prove it using Pumping Lemma, however, when I expand the expression I have both addition and multiplication. I assume that the pumping length is three ($p=3$) and I work on the following word of this l...
I have a fixed rectangle of size X x Y. I also have a bunch of rectangles of different sizes. I want to check if these rectangles can fit in the larger X x Y rectangles knowing that one can rotate any one of them by 90°. Any great algorithm to do this ? I know that some packing algorithm exists and several threads disc...
I'm trying to practice for my upcoming distributed systems test. My teacher said that their will be a problem where he'll give us atomic instructions and we're going to have to implement Mutual Exclusion (ME) using those instructions. Where can I find practice problems/solutions for these types of problems? I can't s...
For some given $n$, how can we check whether there exists $a,b \in \mathbb{N}$ ($b > 0$) such that $a^b = n$ in polynomial time with respect to the number of digits in $n$?
Just a quick question here, is there a known description of a graph family where for every graph $G=(V,E)$ it holds that for every $(u,v) \in E$ you have $|N(u) \cap N(v)| \geq k$? There was a definition for such graph as $k$-community. Even non-trivial examples (e.g., cliques) might be interesting. Also, how to constr...
I thought of a problem which must certainly be known: n persons get an uneven share of m oranges, m being a multiple of n. All the persons having more than m/n oranges are to give their excess share to the less fortunate. What is the minimum number of transactions needed to reach a perfectly even distribution, each tra...
I was going through the B+ tree deletion operation from the book Database System Concepts, 6th Edition by Henry F. Korth. One particular thing caught my attention. A B+ tree is given. We have to delete the record "Gold" from this tree. So we first locate the record by going down the tree and once we find the node, we ...
Aim: schema aware transformation. I've written a code(in js) which can transform data {projectDetails: [ {detail : {}, id : "gwl" }], name: "amit"} into string @gwl|amit. But I'm not able to complete the decoder to transform it back. Problem: logic to transform string back to object In detail Consider that following sc...
I have a confusion regarding how the Kernel is loaded during the boot time. The intuition I have is like following: During installation of an OS, the compiled Code of the Kernel (depending on the architecture of the system) is written to the part of the Primary Memory that is restricted to the OS. When the PC is turned...
If i want to implement a Deterministic Turing Machine from a Non-deterministic Turing machine is always suggested to use the Breadth-first algorithm ? If yes, why ?
Im studing complexity theory and im reading this question on Quora. According to what the guy is saying : if we are able to solve a NP-Hard problem in polynomial time we have prooved that P=NP. But, in P we find problems that can be solved and checked in polynomial time and in this case we have only prooved that NP pro...
I study computer science and hardware. Some problem are about parallel computing and applied Amdahl's law. For instance, some calculation is that the sequential part of a program takes x seconds and the parallel part takes y-x seconds. Can I then safely assume that it is the same percentage of the time that is parallel...
Suppose you have $m $ sources $s_i$ and $n $ sinks $t_j$, but every source produces a certain type of flow, out of $k $ types, and every sink demands a certain type as well. We would like to know if it is possible to satisfy all demands given the constraints in the network. Assume different flows types all have a certa...
Let's say we have given array of $n$ elements, now we want to create data structure that will allow us to get the MEX of its elements, MEX (Minimum EXcluded) meaning the smallest positive integer that is not present in the set. More info from wikipedia. The data structure should also support insert and remove elements ...
im not familiar with the terminology of computer-science which makes it pretty difficult to search for the problem I have. I'm looking for a function that generates a sequence of bits (B) of a given length (i.e. 1024 bit) from a chosen bit-sequence (A) (i.e. 32 bit). This function needs to have the following properties...
Are there any algorithms that use the spectral properties of a graph to solve the minimum spanning tree problem? To clarify further what I have in mind, starting with the Laplacian matrix I want to algebraically arrive at the required set of edges. This is opposed to Prim's or Kruskal's algorithm where the result is o...
Can we implement every algorithm using only immutable variables such that their space and time complexity is the same as using mutable variables?
Let: $INF = \{ w \in \Sigma^* | \quad |L(M_w)| = \infty \} $. It is easy to show with Rices theorem that $INF$ is not decidable. ($INF$ is non-trivial because of $\emptyset$ and $\Sigma^*$). How can you show this with a reduction onto the halting problem (for example)? Here are my thoughts: I had an idea of running t...
While reading a book about algorithms, I came across this derivation: $$ \frac{2a_0(2N) \ln(2N) + O(2N)}{2a_0N\ln N+O(N)} = \frac{2\ln(2N) + O(1)}{\ln N+O(1)} = 2 + O\left(\frac{1}{\log N}\right). $$ Could somebody please explain to me how we went from the left to the right?
I am working on finding a PDA that accepts the following language: L = {0^i 1^j 0^k 1^l | i < j and k < l} I am having trouble figuring out how to break this down/ where to start. I am able to form simpler PDA's such as when there are twice as many 0's as 1's but am drawing a blank on what approach to take to begin to...
Is it known if there are two classes of languages $A$ and $B$ such that: $A$ and $B$ are defined wrt the exact same type of machine (e.g. 1-tape Deterministic Turing Machines, 2-tape Deterministic Turing Machines, 1-tape Nondeterministic Turing Machines, etc); neither $A$ or $B$ are defined wrt a restriction on space ...
The requirement for the conservation of flow in a flow network is, as I see it in the MIT lectures on Algorithms, that $\sum_{v\in V}f(u,v)=0$ for every $u\not\in \{s,t\}$ where $s,t$ are the source and sink respectively. I think I get the intuitive idea expressed here, that there should be no accumulation or net loss...
Is there any algorithm which takes regular expression as input and finds if the regular language which expression describes is infinite?Does it have to do with pumping lemma? Additionally,is there an algorithm which finds if a regular language of a regular expression is the empty set? Thank you
I have graph creation problem. Given a set of nodes of graph, and node constraints such as given every node's number of neighbors and number of neighbors of neighbors and so on. I want to create a graph that can satisfy all these constraints (# of constraints is polynomial in n). I have formulated the problem as an i...
What do people mean when they refer to the "big O complexity" of a function? What is the big O complexity of $9n^2 + 10n$, for example?
I am trying to remove duplicates from an array using the following two algorithms void PrintDuplicates(int[] arr) { if (arr == null) throw new ArgumentException("arr can't be null."); Hashtable table = new Hashtable(); for (int i = 0; i < arr.Length; i++) { if (...
Suppose you have even number of vertices, they form as a complete graph denote the graph by $G$. Now, suppose we compute the minimum weight perfect matching denoted by $P$ (so $P$ has alternating edges, i.e. one is a perfect matching and one is not along all the path $P$ through all vertices of $G$). Now, suppose $T^*$...
Defining $$ o_r(n) = \min \left\{ \hspace{1mm} k \in \mathbb{N} \hspace{2mm} | \hspace{2mm} n^k \equiv 1 \hspace{3mm} (\text{mod } r) \hspace{1mm} \right\} $$ How can we show that finding the smallest $r$ such that $o_r(n) > \log^2(n)$ can be done in polynomial time?
I have to decide if the following language is regular or not. I suspect it is not regular, so I try using pumping lemma to prove it, but something goes wrong. Any help on how to use pumping lemma on this language would be appreciated: $$\{{a^{n^2+2n}|n\ge 0}\}$$ I assume the language is regular. I assume p is the pump...
This question is based on Problem 2 from the 'Bioinformatics contest' of 2018. Given a phylogenetic tree $T=(V,E)$ of $n$ vertices, in which some leaves are assigned an integer color $c$ from $[1,n]$, the task is to find a coloring of the vertices $C:V\rightarrow [1,n]$ such that the subtree induced by each color is co...
I am trying to learn the Big O notation through the example below, can you help? Let S be a set of n vertexes of a graph G and R be a set that the set of edges of G. Specify an upper bound of the size m of R with the big O notation. The bound shall be as tight as possible. Are upper bound of the size m and runtime two ...
I have spent a few hours now trying to understand how the Y Combinator is working and how it allows us to construct recursive functions with higher order functions. I have been going through this derivation http://mvanier.livejournal.com/2897.html which is using the factorial function for explanation which I find quite...
I have a directed graph with the following properties: Except for a few special progenitor nodes, every node has two parent nodes Any node can have any whole number of child nodes The graph is generated such that no node is a descendant of itself in the following way: I starting with a few progenitor nodes (which have...
I learned the proof for the theorem: If A $\leq_m$ B and B is recognizable, then A is recognizable and was provided with the theorem: If A $\leq_m$ B and A is unrecognizable, then B is unrecognizable So does this work both ways? i.e. does this also hold? If A $\leq_m$ B and A is recognizable, then B is recognizable I...
I have the following proof that the Empty String problem: ES = {M | M accepts $\epsilon$} is undecidable: $f<M,w>$ = Construct a new machine $M_2$ such that: $M_2$ = given input x erase x from the tape and run M on w: if M accepts w $\longrightarrow$ accept if M rejects w $\longrightarrow$ accept if M loops on w $\...
I am attempting to parse a large amount of text that cannot be readily used by other software due to the human readable design. However, each "section" of the text has the same format. By "section", I mean lines 1-10 (section 1) will have the same format as lines 11-20 (section 2). My plan is to loop through this text ...
Starting with an image, I have taken its fourier transform and then modified it, and finally taken the inverse fourier transform of the modified fourier transform to get my resulting image. In my result, I get a lot of very small imaginary components in each pixel. My question is what causes these, and is there some ...
Turing machines take inputs that are strings of symbols from some alphabet, and they give outputs that are strings of symbols from the same alphabet. To show that a function is computable, we have to exhibit a Turing machine that computes it. In the case where the function is not from strings to strings, something abou...
Is it possible to solve every problem (solvable with turing machine) with only recursion ? If yes, which principles or theories assure this ? Thanks
I'm trying to prove $\mathsf{FIN} \leq_T \mathsf{REGU}$, where $$\mathsf{FIN} = \{ \langle M \rangle \mid M\text{ is a Turing machine}, L(M) \text{ is a finite language}\},$$ $$\mathsf{REGU} = \{\langle M \rangle \mid M\text{ is a Turing machine}, L(M) \text{ is a regular language}\},$$ $\langle M\rangle$ is the encod...
I am implementing a SAT solver based on DPLL algorithm, and it works fine on small formulas and larger satisfiable problems. My case split is based on a tree like structure, where every branch is tried one by one until solution for the problem is found or until every branch is tried. So my problem now is that the abov...
a question about machine learning, specifically recurrent models: For machine translation recurrent neural networks show great promise, common here is an encoder-decoder architecture which takes a source sentence, reads it, and then based on a compressed representation outputs a target sentence. In opposition to that, ...
I have a model that considers real values and that uses a binary variable $x$. In this model, the following conditions should apply: \begin{equation} x= \begin{cases} 0, & \text{if}\ y > s \\ 1, & \text{otherwise}~(y \le s) \end{cases} \end{equation} with $y \ge 0$ and $s \ge 0$. First I tried...
I am currently studying the paper Primes is in P and have a question regarding 5 section of this paper. Line 1 of the algorithm (on page 3) requires the following operation to be performed if (n = a^b for some natural numbers a and b), output 'composite' I have attempted to deduce the complexity of this line and have ...
I'd like to solve the questions below with repeated or conditional evaluation but I don't know how. Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size n, insertion sort runs in $8n^2$ steps, while merge sort runs in $64n*log(2,n)$ steps. For which values ...
I'm preparing for the next hashcode by solving the following prev. problem: Given a pizza of size R x C with cells containing either mushrooms or tomatoes as shown bellow: We are given 2 parameters: L and H. The goal is to split the pizza into rectangular slices such that each rectangle contains at least L cells of mu...
Consider a large graph, minimum 1 000 vertices but it can easily go up to 50 000 vertices depending the case. The graph is the result of social relationships (followers, following, friendship) so it can be oriented but for the ease of the solution let's say it's not, so the matrix is symmetric. Moreover the matrix of a...
You are given a string with wildcards, e.g. X***Y*Z. Your goal is to print an input string filling all the wildcards in the given string. You are allowed to write data to the string in blocks of fixed size: character-by-character, you can write contiguous blocks of identical characters of length 2, 3 ... N: X, XX, XXX,...
In $\lambda$-calculus, we can encode arithmetic, numbers, booleans, and even compute factorials of numbers, as shown here. Is there encoding of "for" or "while"?
I'm a student of Formal Methods in Software Engineering, I'm trying to study this question for two days but still haven't figured it out, I couldn't even find a similar solution or explanation, so please if anyone can explain in detail the question and it's solution I've provided in the image, it'll be a real help. One...
I'm having trouble solving this exercise about graphs, I hope you can help me: Given a graph $G = (V,E)$, two sets of vertices $A \subseteq V$ and $B \subseteq V$ (represented as arrays), and an integer $k$, verify in $O(|V|+|E|)$ if each path that starts from a vertex $v \in A$ and connect a vertex $u \in B$ have a le...
I work in Search and have seen following problem appear in different forms. There are many users in an enterprise; they have ability to create records. Each user has variable level of access to some or all of the records of the enterprise; and the record creator can manage access to the record. How do we design a sear...
I have a question about the Hadamard Gate on entangled qubits. I’m very newb to quantum computing and does not have any professional knowledge in physics nor mathematics. However I’ve tried some different algorithms in IBM’s quantum experience and think I got the idea about how the qubits works in the block sphere. Bec...
I'm approaching the following problem: Given some input array $A$ of length $n$, and integer tuple $(j,k)$, I want to determine if there exists a contiguous subarray of length $j$ with all elements greater than $k$. The $O(n)$ algorithm is straightforward, but becomes inefficient when confronting a modified version of ...
I need to choose a language, design a finite automaton M such that L = L(M). Construct a minimum-state DFA M′ equivalent to M in such a way that the ratio of the number of states in M to the number of states in M′ is less than 0.5. I have zero idea as to how I should approach this. I've tried considering a few DFA's, a...
I am referring to the Marking algorithm defined in this article: https://arxiv.org/pdf/1602.00621.pdf The Marking method is defined at the bottom of page 4 and has a pseudo code at the beginning of page 5. In page 7 they claim "The runtime of the marking stage is O(B)". B being an upper bound for the number of marks of...
How can I prove distribution of division over union in relational algebra, i.e. the following: $$(R \cup S) / X \overset{?}{=} (R / X) \cup (S / X)$$
I'm attempting to convert a CFG into an LL(1) grammar for predictive parsing in a compiler. I've been able to left factor and eliminate left recursion and ambiguity for every case in the grammar, with the follow exception. I've provided the simplest case to illustrate the problem below. S -> a b S | T T -> a c T | d T...
Let $\mathcal{F} = \{ f_{s} \}_{s \in \{\, 0,1 \,\}^{*}}$ be a family of computable functions, where $f_{s} \colon \{\, 0,1 \,\}^{|s|} \rightarrow \{\, 0,1 \,\}^{|s|}$. We define a family of functions $\mathcal{H} = \{ h_{s} \}_{s \in \{\, 0,1 \,\}^{*}}$, where $h_{s} \colon \{\, 0,1 \,\}^{|s|} \rightarrow \{\, 0,1 \,\...
PDA = Pushdown Automata Let's assume I have this language: $L = \{a^nb^ma^n | m,n \ge 1\}$ Would the first approach with one node be enough - in that case it guess twice the $\lambda$. In the second approach it's deterministic, which is fine.
I'm working through Deep Learning by Goodfellow et al. The textbook introduces backpropagation for MLPs in page 203 (http://www.deeplearningbook.org/contents/mlp.html). However, it does not expand further and illustrate the (full or stochastic) gradient descent update. I'd like to confirm the full gradient descent upd...
Question: Check if number of $a$ are prime with just two tapes in Tuning machine. I'm not quite sure how to check it but what I've got so far is: First tape will be the input. For example $aaaaa$ Second tape will be checking the numbers $2$ till $n-1$, meaning $4$ for this example. We start checking them both from the ...
I am implementing a topic suggestion system to a website. The aim is to add links to the left panel of each topic. For example, I opened the topic named "topic1", left of the page should show 5 additional topic links, say "topic48", "topic1453", "topic1905", "topic35", "topic63". Objectives are as follows: 1) Distribut...
I'm curious if anything like this has been proved, or is even possible to prove a statement like: "Out of all sorting algorithms, this one has the lowest time complexity for the worst-case." Or stated more specifically, the statement could look like: "Quicksort has the lowest time complexity for worst case of all sorti...
Theorem: (Stockmeyer, 1974) Any circuit that takes as input a formula (in the language of WS1S) with up to 616 symbols and produces as output a correct answer saying whether the formula is valid or not, requires at least $10^{123}$ gates. Suppose we have generalized theorem: Any circuit that takes as input a f...
I am aware of a O(n) algorithm for constructing a new heap of n items, this is better than repeatedly inserting into an empty heap which takes O(nlogn). I would like to know if there is something similar for inserting a group of n items into an existing heap. Rather than using repeated insertion, is there something mor...
A regular expression $r$ is said to be in disjunctive normal form if it can be written in the form $r = r_1 +r_2 +\dots+r_n$ for some $n ≥ 1$, where none of the regular expressions $r_1, r_2, \dots, r_n$ contains the symbol $+$ (union). For example, the regular expression $a^*b^* + (ab)^* + (c(acb)^*)^*$ is in disjunc...
So I am working on implementing YOLOv2 using my own dataset, for face detection. This requires me to prepare a training set of images annotated with the bounding box extents of faces within each image. My question is: is there any convention for what we define as the face in face detection? For example, do we include t...
I have a problem. Below I present a function in Python. def exist2(Sunion, Sunion_vsum, S, vsum): for xunion_id in range(len(Sunion)): if(vsum < Sunion_vsum[xunion_id]): plist = list(set(S) - set(Sunion[xunion_id])) diff = 0 for i in plist: diff = diff +...
I have a question in my homework that deals with the concept of a definite language. The question defines a definite language as follows - "A language L is definite if there is some k(> 0) such that for any string w, whether w ∈ L depends on the last k symbols of w." I'm supposed to do the following - a) Rewrite this...
I was asked to sort several functions by their asymptotic growth. I was docked a couple points for incorrect ordering and the correct solution was never provided. For what it's worth, this assignment has already been graded, I'm just wondering where I went wrong. (None $\sim$ indicates functions have similar asymptotic...
I want to write a JavaScript cross referencer (in Python) that will build a cross-reference of JavaScript functions for a given input file. I am trying to think of what Abstract Data Type would work well for this to represent the call tree. I am thinking of using a General Tree (a tree that has a root node with many br...
I am trying to find the path for the most negative cycle in a graph G which starts and ends at a specified source node S. I have studied an application/ extension of the Bellman-Ford algorithm (henceforth referred to as the "Huang algorithm") found here which describes how to find a negative cycle reachable from a spec...
Definition: In geometry, a polyhedron (plural polyhedra or polyhedrons) is solid in three dimensions with flat polygonal faces, straight edges, and sharp corners or vertices. We have a closed domain with a certain number of faces (a cube, pyramids). For example: Imagine we distribute n finite plane (for simplicity fla...
How to find the minimum and maximum of subroutine median3(x,y,z) from a totally ordered set?
I am looking for a reference explaining how to solve Navier-Stokes numerically using Machine learning algorithms . Thank you in advance for your help .
In some programming languages type of variable goes before it's name. In another - name goes first and then type. Which version loads brain less and allow easier think about problem ?
So I am learning to do SDP relaxation on graph problems, and for this max cut problem I am given a 500*500 graph, and I am using the straightforward relaxation. $W$ is the weight matrix, $X = u u^T$ where $u$ is the original variables. $$ \max < (I-W),X> $$ $$ s.t. X_{ii} = 1, \forall i$$ $$ X \succeq 0$$ Problem is: ...
Lets assume there is no upper limit on number of machines. Here are the goals of partition: Each node in the graph has a weight. There is an upper limit on total weight stored on a machine. All the nodes are not fitting on one machine, hence we are starting with partition. When we store an edge on a machine, then th...
When trying to prove that a recurrence $g(n)$ satisfies $g(n) = O(f(n))$, we sometimes are not able to find a valid $C$ to show the upper bound, so we try to prove it is $O(f(n-d))$ for some constant $d$ instead. If we are able to prove that $g(n) = O(f(n-d)$, does this mean that it is also $O(f(n))$? If so, does thi...
I am searching for the most efficent implementation of a specific algorithm: Assume you have a set of positive integers, for example: X = [1,1,2,3,3,6,8] The aim is to find exactly two sets (containing together all elements of X), so that the sum of all elements of the one is equal to the sum of the other. So for examp...
Is there a known example of two complexity classes, $A$ and $B$, such that: $A \neq B$; there is an oracle $O$ for which $A^O = B^O$? I strongly believe that there are such examples, as otherwise $P = PSPACE$ (note that $P^{PSPACE} = PSPACE^{PSPACE}$), but I was looking for an example of this.
I'm taking a course about Information Retrieval and we had a quiz involving the evaluation of search engines. We had a problematic question regarding "Query Logs" (basically recording the queries that users searched in the past and their response for the queries e.g links clicked), and I hope you can help me figure out...
While working on my research for my master thesis I have stumbled upon the following problem: Given $N$ groups of different sizes, create all the possible combinations $p$ such that: $p = \{e_{0,j_0},e_{1,j_1},...,e_{N,j_k}\}$ for all $e_{i,j}$. where $i$ stands for the index of the group and $j$ stands for the index ...
What I have come across as a definition is - a language $L ⊆ Σ^*$ is said to be definite if and only if $L = E ∪ Σ^*Η$, for some finite languages $E,H ⊆ Σ^*$ Using these questions - Show that every definite language is accepted by a finite automaton and What are definite languages? How do you formally define them?, I u...
I am reading this paper named "Matching triangles and basing hardness on an extremely popular conjecture" in the second page of this paper there is this paragraph: Observe that the ∆-Matching-Triangles problem with ∆ = 1 simply asks if there is a triangle in the graph and can, therefore, be solved in O(n^ω) time, where...
The problem I have is as follows: I have a complete bipartite graph $G=(V \cup C,E)$ as input, where $|V|=1, |C|=n, |E|=n$ The interpretation is that the node of $V$ is a vehicle, the $n$ nodes of C are incidents and the $n$ edges from $V$ to $C$ are the travel times from the vehicle to the incidents. Now the inciden...
I was given the following problem as homework: Let $x$, $y$ be words over an alphabet $Σ$. Prove that $xy = yx$ iff there exists a word $z$ such that $x^2y^2 = z^2$. I was hinted that I am supposed to approach this problem using structural induction. Considering the case where $|x| = |y|$, you obviously get $x=y=z...
For any given set of real numbers, find the minimum set of intervals with length 1 that include all elements. For example, for the set: $${\{1.5,2.3,2.4,2.5,2.8,3.3,3.6,3.8}\}$$ the answer is $${\{[1.5,2.5],[2.8,3.8]\}}$$ On the example above $[1.5,2.5]$ is an interval with length $1$ ($2.5-1.5=1$). And there are 2 set...
I've been thinking for some time but can't figure a way out. I have big bitarray i.e. 1000+ items of 10_000 bits strings, I'm searching them now linearly. (currently it is stored in one chunk of memory). I'm looking for some better algorithm for searching/matching ! Do you have any idea ? bitarray looks like this : 0)...
How can I write an O(n)-time algorithm to find the minimum and maximum, given a list of n elements drawn from a totally ordered set using the subroutine median3(x,y,z) which returns the index of three elements x,y,z? You are not allowed to read or compare the elements directly; the only operation that is allowed is i...
I'm trying to get at least a laymans understanding of how the Longest Common Sequence (LCS henceforth) can be shown to be NP-Hard and I'm trying to do that by reducing it to an NP-Complete problem like Vertex Cover. I read through this downvoted question on another stack exchange. I am trying to understand the demostr...
In a partially ordered set L, an antichain is a subset A of L such that no two elements of A are comparable. Antichains are commonly used to represent upward-closed subsets of L, that is, sets S such that if x is in S, any y ≥ x is also in S: if L is finite (the situation is more complicated in the infinite case), then...
Im studying the semidecidability of First Order logic. According to wiki A logical system is semidecidable if there is an effective method for generating theorems (and only theorems) such that every theorem will eventually be generated. This is different from decidability because in a semidecidable system there...
This is another homework problem I'm stuck with. For the given finite automata, I am asked to find out the equivalent regular expression. On inspecting the given automata, I started deducing the expressions that it accepts and tried to find a pattern, and this is what I was able to figure out - The automata makes the...