instruction
stringlengths
35
29.1k
I would like to double check myself. As I understand time complexity of comparing two strings in the worst case is $O(n)$, where $n$ is the length of the strings (let's say they are equal length). In case I have $N$ strings and I would like to know whether they are all different. Is there an algorithm for this that is ...
Suppose I have two sets of integers $A$ and $B$ and I have a sketch data structure described by a function $\mathsf{sketch}_n : \mathcal{P}(\mathbb{Z}) \to 2^n$ that returns a bitstring of size $n$. These sketches can be checked for disjointness with a function $\mathsf{disjoint}_n : 2^n \times 2^n \to 2$, where if $\m...
I'm learning about computable functions. Our definition for computable function is as follows: Informally, a computable function is a function f : A → B such that there is a mechanical procedure for computing the result f(a) ∈ B for every a ∈ A. they go on to give the following non-example: A function that takes an ...
Since reproducibility is a major principle or basic norm of scientific experiments, simulations, and computations, what would you do or what to do if the author of a published CS article does not respond to code requests? Thanks a lot!
Problem Statement: Given a string/pattern only consisting of '<' and '>' symbol, find the lexicographically smallest string that satisfies the pattern(made up of only lowercase english alphabets). Some examples are given below for better understanding. Examples: Input(String) - '>>' Output(String) - 'cba' (because c >...
is it correct to compute the average case time complexity of an algorithm by taking the mean of the best and worst cases ? My findings : for binary search, $\frac{\log (n) +1}{2}\in \Theta \left(\log (n )\right)\implies $ the average case is $\log (n).$
How we can prove that: $$ \sum_{k=1}^{c \log n-1}\:k\cdot \left(\frac{1}{2}\right)^{\frac{k}{3}}\in O\left(1\right) \quad \mbox{?} $$
I want to convert an IF statement for my optimization problem. I want to minimize the total price. I want 800 tones of salt and 3 suppliers offer me their prices. Supplier $1$ offers me $100$ tones at $\\\$150$ a tone. Supplier $2$ offers me $400$ tones at $\\\$170$ a tone, if I take $300$ tones (or more)the price drop...
I'm not sure if I understand the difference between Turing Complete and Turing Equivalent programming languages. A computational system that can compute every Turing-computable function is called Turing-complete (or Turing-powerful). A Turing-complete system is called Turing-equivalent if every function it can compute...
I have read (in this question) that this recursion can't be solved via Master Theorem. But I couldn't find exact and complete proof why the Master Theorem does not apply.
I need to compress a string in my application but I am very limited in the operations I can perform. In particular, I cannot store data in any file and I cannot query any database. Also, I cannot call any library so I have to code my own data compression algorithm. What would be the simplest algorithm to achieve this g...
Suppose I have a sorting algorithm that sorts a list integers. When the input size(the number of elements) $n$ is odd, it sorts using Bubble Sort and for even $n$ it uses Merge Sort. How do we perform the worst-case time complexity analysis for this algorithm? The context in which this question came about is when I was...
Is object oriented programming considered to be a declarative programming approach? On Wikipedia, it is said that OOP tries to extend the imperative programming paradigm to a somewhat declarative programming approach, but what precisely makes OOP imperative or declarative?
I want to know how switch-efficient a multiplier can be. If I need to do many $N$-bit by $N$-bit multiplies, and each bit is determined by flipping a coin, what's the average number of transistor switches that will be required per multiply, in terms of $N$?
Can we design an algorithm to test if a infinite regular language is a code? We have the S-P algorithm to determinate if a finite language is a code. But how about the infinite part of regular languages? If we have a regex which describes our set of words, then is it possible to modify the S-P algorithm to work on an i...
How can I convert a XOR statement into linear constraints for integer programming ? The expression is $(x_1 \geq 1)$ XOR $(x_2 \geq 1)$ where $x_1$ and $x_2$ are integer. It means that if $x_1 \geq 1$ then $x_2 = 0$ and vice versa. I started to linearize the statement by : $(x_1 \geq 1)$ XOR $(x_2 \geq 1) = (x_1 \geq 1...
I was reading Complexity: The Emerging Science at the Edge of Order and Chaos and a certain passage got me really intrigued. When discussing Chris Langton's explorations of artificial life algorithms, the author paraphrases Langton stating the following about a certain set of evolutionary algorithms: This is the unde...
Let $\Sigma = \{a,b,c,\ldots,x,y,z\}$ be the Latin alphabet, consisting of 26 letters. Consider the language $L$ of all words $\alpha$ over $\Sigma$ satisfying the following constraints: If $\alpha$ contains $a$ then it contains exactly $4$ many $a$s. If $\alpha$ contains $b$ then it contains exactly $8$ many $b$s. .....
So watching many youtube channels, the explanation to the impossibility of solving the halting problen involves assuming you can, doing the opposite, and feeding it back into itself to create a paradox. What I don't get is why this is an (over)simplification. The logic seems to check out. What is the flaw in this reaso...
I'm trying to prove the following reduction: $$ t\{x:=u\}\{y:=v\} = t\{y:=v\}\{x:=u\{y:=v\}\} $$ under the following assumptions: $x \neq y$ $x$ is not a free variable of $v$ (in symbols, $x \notin \operatorname{fv}(v)$). My idea is to do it by induction, but I'm a bit stuck with the base case. I would appreciat...
I understand that we might need hierarchical paging to handle page tables with sizes greater than the size of one frame, but what is the use of Hashed Page tables then? I would understand if we were storing page-numbers and mapped frame numbers as $key-value$ pairs, because then hashing would make the process of access...
Let $L_0 = \{ \langle M, w, 0 \rangle \mid M \text{ halts on } w\}$ and $L_1 = \{\langle M, w, 1\rangle \mid M \text{ does not halt on } w\}$. In $\langle M,w,i \rangle$, the $i$ indicates a specific bit such as $0$ for language $L_0$ and $1$ for language $L_1$. I want to prove that $L = L_0 \cup L_1$ is unrecognizable...
I am just learning backpropagation algorithm for NN and currently I am stuck with the right derivative of Binary Cross Entropy as loss function. Here it is: def binary_crossentropy(y, y_out): return -1 * (y * np.log(y_out) + (1-y)*np.log(1-y_out)) def binary_crossentropy_dev(y, y_out): return binary_crossentro...
PRE-WORK-POST is a theoretical programming language with the following structure, where P,Q and R are LOOP program: $$\text{PRE} \ P \ \text{WORK} \ Q \ \text{POST} \ R \ \text{END}$$ First $P$ is executed. Then $Q$ is executed until $x_0 \neq 0$. Finally $R$ is executed. I have to prove that PRE-WORK-POST is Turing c...
I'm currently studying Sequential consistency vs linearizability: I know that SC has to be consistent with the order of how the individual client issued them, and for linearizability, it's with the real-time ordering. What I don't understand is: "The interleaved sequence of operations meets the specification of a (sing...
If a decision problem is in P, is the associated optimization problem then also efficiently solvable? I always thought that this is the case but according to Wikipedia page on Decision Problems the complexity of a decision and function problem might differ and to me a function problem was always a special case of an op...
I'm trying to solve this problem - https://codeforces.com/problemset/problem/711/E I've already found and proved that the result is equal to: $$ 1 - \frac{2^n (2^n - 1) \cdots (2 ^ n - k + 1)}{2^{nk}}. $$ Now I need to compute it, and it's hard as $n$ and $k$ could both be as large as $10^{18}$. Computing $2^{nk}$ ...
I have found a problem about proving whether $L^{|2|}=\{w_1w_2 \mid w_1,w_2\in L, |w_1|=|w_2|\}$ is context-free or not, knowing that $L$ is regular So far I know that: There are examples where $L$ is regular and $L^{|2|}$ is regular (for example $L=\{a,b\}$) There are examples where $L$ is regular and $L^{|2|}$ is no...
This is a rather well known solution to the $k$-th order statistic problem which requires us to find the $k$-th largest number in an unsorted array with $n$ elements where $1 \leq k \leq n$: public int findKthLargest(int[] nums, int k) { PriorityQueue<Integer> heap = new PriorityQueue<Integer>(); ...
How can I compare $(\log^*n)!$ with $(n\log n)^b$? I know that $n^b<n!$.
I want to prove any AVL tree can be turnt into a red-black tree by coloring nodes appropriately. Let $h$ be the height of a subtree of an AVL tree. It is given that such a coloring is constrained by these cases: $h$ even $\implies$ black height $=$ $\frac{h}{2} + 1$, root node black $h$ odd $\implies$ black height $=$...
For optimization problems, I found complexity classes analog to some classes for decision problems, e.g. PO and NPO, mirroring P and NP for decision problems in the sense that optimization problems in PO can be solved in polynomial time and verified in polynomial time, respectively. Are there similar class definitions ...
I know the proof that using nondeterministic TM, but as I understood there is another proof without nondeterministic TM. If you answer please write with as much details as you can.
Suppose I am a bus transportation company. I have n buses. I want to change the bus routes so that the "average" commuter spends as little time on the bus as possible, while being able to arrive at as close to their final bus station at their desired time as reasonably possible. Inputs: Origin bus stations, destination...
Say we have two sets of points in vector-2 space (In actuality need to solve this problem in vector-3 space but decided to start with a simpler problem). The points in the second set are the result of transformation of the points in the first set. It's not known which point in the first set corresponds to which point i...
I'm trying to build a scheduling app for a friend, but am stuck on how to sort the employees. I have three holidays each with their own employee_need: thanks_giving: 2 christmas: 3 new_years_eve: 2 I have employees who have a predetermined number of days they will work. The sum of the employee’s predetermined work days...
For the function $f(n) = 100n + 5$, what is the asymptotic complexity of $f(n)$ in terms of Big O notation. I guess it is $O(n)$, but how can I prove it ?
Can we classify a supercomputer in more than one group? For example, Flynn's classification, classification according to topology, classification according to memory access. For the Summit supercomputer, I have found no sources on these topics, except for Flynn's classification. How can I classify it in other categorie...
Let us say you have a function $C_n = (-2)^n + 2^n$. It would seem that it would be correct to assume that the running time of this algorithm would be $O(2^n)$. However, how would I go about arguing this? The rule I had in mind would be that $a^n$ is $O(b^n)$ if $0 < a \leq b$. But since $a$ is $< 0$, this rule cannot ...
I am approaching a problem where, among other things, I will have to repeatedly check if a point is within a (set of) polygon(s) in the 2D plane. the polygons are either convex or star-shaped with a non-singular kernel if multiple polygons, they touch each other (have at least a side in common with another polygon of ...
I want to implement a recommender system based on collaborative filtering. Each user will have a set of visualized items (0-1's) and based on that similitude the recommendation will be generated. In order to develop this, I was thinking of using the Jaccard similarity coefficient (if anyone has a better suggestion plea...
In a relation R, if X is some set of attributes and Y is some prime attribute such that X uniquely determines Y is a non-trivial FD. Then is it true that R has at least two candidate keys? For instance, take the relation schema R(Class_Id, Course_Number, Instructor_Name, Text). {Class_Id, Course_number} is a candidate...
In our assignment we are given a grammar (called minipython) and we are asked to implement some phases of compilation (parsing, some semantic analysis). One of the requirements is to be able to check for types in an arithmetic expression (arithmetic expressions are only defined for integers). For example in the below c...
The sorting algorithms (merge-sort, quicksort...) are tought to have an absolutely hard lower bound which can not be outperformed by computation alone and this bound is $n*log_{2}(n)$, The reason for this bound is that those algorithms are using the division by two devide and conquer method and as such they generate a ...
Regarding the following languages $L_1$ and $L_2$, I want to prove that $L_1$ is decidable and $L_2$ is undecidable. I want to construct a turing machine which can decide $L_1$ and reduce the halting problem to $L_2$. $L_1$: On input $w$ the turing machine $M$ never moves it's reading/writing head left. Where $w \in \...
Let $\langle M\rangle$ be the encoding of a Turing machine as a string over $\Sigma=\{0,1\}$, and consider the language $L=\{\langle M\rangle| \text{ $M$ is a Turing machine that accepts a string of length 2014} \}$ I want to use The Rice-McNaughton-Myhill-Shapiro Theorem (page 14 in this) to prove that $L$ is acceptab...
I am trying to understand the Mahalanobis distance of a point from the plane given by this paper. The algorithm is given below: Calculate covariance of point $S_{uu}$ Apply a whitening transform to the covariance matrix using SVD where $S_{uu} = RVR^T$. $R$ is the rotation matrix and $V$ is the scale $V = diag(a^2, b^...
So I'm currently reading about neuroevolution (NEAT, WANN) and trying to make my own implementation just as an exercise. Now I want to test if my feedforward implementation gives the expected output. I'm doing this manually right now and it's starting to get tedious, specially since the resulting topology is kind of cr...
There's a gacha RPG I'm trying to get better at. I estimate there are about 10^15 states for the 3 opening rounds of a match for which I am trying to evaluate damage output. The equations themselves aren't complicated: mostly linear ones, with the odd division and factorial with small integers (less then n=10) thrown i...
I am looking for a pairing function with linear time complexity. I found one in Steven Pigeon's thesis (p 115, §5.3.6.3) described in English on MathOverflow that works by bit interleaving. another from Regan's 1992 paper (p 289, last paragraph) that works by bit concatenation based on a state machine. The one from P...
Basically, it's this rosalind problem. You're given a number of nodes and an adjacency list. My initial guess was that the answer was the number of connected components minus 1, since by joining every connected component you would have a connected graph, and since it's stated that there are no cycles, that would be a t...
In brief: Here I have a cyclic graph above. I want to partition the graph vertices into 3 clusters. (With the mindset of cluster-wise "load balancing") Constraint: All the vertices in each cluster should be directly connected. Goal: the deviance of the cluster-sums should be as small as possible. (In other words, the...
While reading a paper (On the k-coloring of intervals), I came upon the following description: "Input: An integer k, and a set of n intervals sorted by right and left endpoints. The intervals are indexed in order of increasing right endpoint, and it is assumed that all endpoints are positive integers." What does it mea...
I want to calculate the RMS AC value of a signal made up of several thousand readings every second. The processor that I am using doesn't have enough memory to store a whole second of data, so I want to calculate it the sum of squares the fly. This is the normal formula to calculate the RMS AC value, where you have to ...
Make is a very common English word and consequently I cannot find the answer using google. I am writing a script to automate all the data generation process, which resembles what GNU make does. I am curious to know which type of algorithm GNU make uses under the hood. I suppose it is some sort topological sort with BFS...
I'm studying for my finals and I came across this question from past exams: Is the following language decidable? $$ L = \{ \langle M_1,M_2,w \rangle \mid w \in L(M_1) \setminus L(M_2) \}. $$ How can I be sure of my answer? Is there any way to know for sure?
I am currently working on my Master thesis on the visualization of music structure and I'm looking to find an optimal description of repetitions found in a piece of music. Problem Description Given a section range in a song in seconds (or samples) , e.g. [10,20], I can look up where this section is repeated. Then we en...
I want to check if I understood it in the right way. In some example where $L\in RE$ the explanation deal with 2 cases: 1st when $L$ finite and 2nd when $L$ infinite. In the second case $L\in R$, isn't? Is it possible somehow that $L\in RE\setminus R$ be finite?
I read this paper obout simCLR and I didn't understand a few things: What is the goal of the temperature parameter τ? How does it affect the loss? What will be the value of the loss for a batch with 2N identical samples? Is there a mathematical formulation? In that case (question 2), will different temperature values ...
Give two Prolog implementations to calculate the sum of first N numbers divisible by 3. For example: N=4 -> 30 (3+6+9+12). sum(N,I,C,C):-!. sum(N,I,C,R):- I mod 3 =:= 0, C1 is C+I, I1 is I+1, sum(N,I1,C1,R). sum(N,I,C,R):- not(I mod 3 =:= 0), I1 is I+1, sum(N,I1,C,R). I tried like this, bu...
Is there a polynomial time algorithm to determine the number of reachable states in the subset construction of a NFA to a DFA without having to construct the entire DFA?
I'm trying to understand the reduction as a flowchart graph. Let's say the boxes $A$ and $B$ are TMs/Functions and $x$ is the input. Is this plot represent reduction from $A$ to $B$ ($A\le B$) or from $B$ to $A$ ($B\le A$)? Or maybe it can be both of the way depending on the context?
It is well-known that the Sierpiński space, $\{F,T\}$ endowed with topology $\{\emptyset, \{F\},\{F,T\}\}$, is admissible. I tried to implement it in Haskell. First I implement $\mathbb{N}$ (including zero; some topologists might prefer denoting it by $S_\omega$) by Peano definition: data Peano = Zero | Succ Peano deri...
Imagine I want to construct a total order from a set of elements, $E$, but the comparison function produces results that are non-deterministic. I produce a list of element pairs (e, e) through repeated application of the comparison function, such that each element in the set is represented at least once. How can I use ...
On an imperative programming language, let us consider the following program: for i in 0..N { // N is the length of the arrays A, B, C. A[i] = A[i] + B[i]; } for i in 0..N { A[i] = A[i] + C[i]; } This program just sums three arrays $A + B + C$ component-wisely and store it to $A$. We can easily transform this prog...
For a research project, I tried to prove or disprove that a function called xxhash128_low is a bijection from 64 bit unsigned integer to 64 bit unsigned integer. I have shown that it is sufficient to prove that the following critical code is a bijection: Input: a 64-bit integer x 0. Let c=0x9e3779b185ebcaa7 1. Let x_lo...
I am trying to find a grammar for $L=\{a^nb^mc^rd^s| n+m<r+s\}$, which has the hint of it having "some similarity" to $L=\{a^ib^j|i<j\}$ This last one is quite easy to get ($S\to aSb | Sb | b$), but still I am unsure on how to proceed. I expect to manipulate the language by differentiating cases, and for example I foun...
Context This question is related to the fact one can't use Bellman-Ford to find max weight paths in directed graphs with cycles. The reason is that giving a new graph $\tilde{G}$ with negative weights (e.g. $\tilde{w}_{ij} = - w_{ij}$) will result in cycles with negative sum, thus no minimum cost walk exists in $\tilde...
My question is not about how arraylists or linked-lists work, but why there aren't other types of lists. From my understanding, memory is accessed linearly by adresses. Thus, you have the choice to use property for your list or not to. In the case of a arraylist, you know where an item lies by looking where the element...
As explained in answers to this question, reduction from $A \le B$ can be represented in the following way. But in this example: from here At least as I understand it: The reduction is from $\overline{HP}$ to $L_2$, so $A$ is $\overline{HP}$ and $B$ is $L_2$. But it's implemented in the way that $M'$ is TM of $L_2$ a...
I came up with a solution for LeetCode Problem 4: Median of Two Sorted Arrays The expected efficiency of this should be $O(\log(m+n))$, where $m$ and $n$ are the lengths of nums1 and nums2. For my solution I decided only to process only the first half of nums1 and nums2. Does that count as logarithmic time, or is it st...
I am trying to build a classification algorithm having 28 classes. These classes consists of Logo of companies like adidas , Nike etc. I have very low dataset below than 100 images and greater than 70 images. I have trained CNN model but not got decent results . Accuracy is not good. I want to switch on pretrained mode...
Theorem 15.1 (Optimal Substructure of an LCS) Theorem Let the $X=(x_1,x_2,\dots,x_m)$ and $Y=(y_1,y_2,\dots,y_n)$ be sequences, and let $Z =(z_1,z_2,\dots,z_k)$ be any LCS. If $x_m = y_n$, then $z_k = x_m = y_n$ and $Z_{k-1}$ is an LCS of $X_{m-1}$ and $Y_{n-1}$. If $x_m \neq y_n$, then $z_k \neq x_m$ implies that ...
I saw the solution but can't understand the intuition of the following question: Let's define $$L^{\ge k} = \{w\in L : |w| \ge k\}$$ and $$L=\{\langle M\rangle | \exists k:L(M)^{\ge k} = \overline{HP}^{\ge k} \}$$ $L\in R$ because $L=\emptyset$, the proof is a bit long and anyway I understood most of the steps, My ques...
Just out of theoretical curiosity, is there a way to transform a 0-1 multimensional knapsack problem to a maximum clique problem? Or maybe even easier, to a maximum weighted clique problem (the weights in nodes)? I assume that since the decision counterparts of both problems are NP-complete, and all NP-complete can be ...
In computer architecture I'm confused between speculative execution & branch prediction. Are the same or different?
Context I have a graph $G=(V,E)$ with weighted edges, all weights are positive integers $w(e)\in\mathbb{N}\setminus\{0\}$. The weights represent the popularity/count of each edge, for example $w(e) = 22$ means that amongst all edges the edge $e$ was visited $22$ times. Approach Given two vertices $v,v'$ in $G$, how can...
I am a CS first year student, and as I was reviewing over the theta notation unit, I saw that $\Theta(1)$ exists. I was wondering if there was any real life example algorithm that has a running time of $\Theta(1)$.
I have created a function that generates a complete, directed, and weighted graph, represented in an adjacency matrix but most Bellman-Ford implementations use an adjacency list. Is it even possible to use an adjacency matrix for Bellman-Ford without increasing significant time complexity? What would be the simplest wa...
It's claim 1 from Bader Abu Radi's solution to this question. My solution (have no idea how wrong it is): $B$ finite $\Rightarrow$ $B\in R \Rightarrow$ exists TM $\langle M_B\rangle$ that halts $B$. *Wrong from here Let's define reduction $f$ from $A$ to $A \setminus B$, in the following way $f(\langle M_B\rangle , x)=...
I am asked to select the functions that are bounded by the Big-Oh function O(n^2): $f(n) \in O(n^2)$. $f(n) = \sum_{i=1}^{n} n$ $f(n) = \sum_{i=1}^{n} i$ $f(n) = n + n^2$ $f(n) = 1$ I choose the answers 1, 2, and 4: Simplifies to $n \cdot n = n^2$, which is bounded by $O(n^2)$ Simplifies to $\frac{n(n + 1)}{2} = n^2...
I'd like to learn about formal syntax of programming languages: how do we describe the syntax of a programming language and how it should be parsed? How do we assign formal semantics to a parsed program? I've looked at textbooks like this one, but it is very practical. I am looking for something more theoretical: an in...
How many hardware page tables (physical) and page directories are kept in the memory management unit? If a cpu has a 32 bit virtual address, the upper 10 bits are used for the page directory, the middle 10 bits for the page table, and 12 bits for the 4K page frame. Does that mean 1 page directory containing 1042, 32 bi...
I am asked to select the bounding Big-O and Big-Omega functions of the following program: void recursiveFunction(int n) { if (n < 2) { return; } recursiveFunction(n - 1); recursiveFunction(n - 2); } From my understanding, this is a Fibonacci sequence, and according to this article here, https:...
One of my previous questions on an exam was the following Can you reduce a decidable language to a given regular language? (decidable language $\leq _m$ regular language). If so, does this mean that you can reduce every CFL to a regular language? The reductions are all referring to many-one reductions. My intuition t...
I'm trying to solve this recurrence. I applied the iterative method: $$T(n) = T(n-2)+n^2$$ $$=T(n-4)+(n-2)^2+n^2$$ $$=T(n-6)+(n-4)^2+(n-2)^2+n^2$$ $$\cdot$$$$\cdot$$$$\cdot$$ $$=T(n-2k) + \sum_{i=0}^{k-1}(n-2i)^2$$ So $n-2k=1$ when $n=2k+1$ and we have: $$\sum_{i=0}^{(n-3)/2}(n-2i)^2$$ Now how can I demonstrate that th...
Before I start with my question, I want to state some notation I am using. I fix some arbitrary but fixed enumeration of Turing Machines (TMs) and denote with $\Phi_i : \mathbb{N}\to\mathbb{N}$ the function that is computed by the $i^\text{th}$ TM in this enumeration. Furthermore $\Phi_i(x) \downarrow$ denotes that the...
I am reading Algorithms by Sanjoy Dasgupta, Umesh Vazirani, Christos Papadimitriou and I am trying to understand how the number of steps $nF_n$ and $n^2$ were calculated. Here's the part of the book in Chapter 0 that mentions them. Functions fib1 and fib2 are written below the excerpt. fib1, which performs about $F_n$...
If you are given two languages $A$, $B$ and $$A \leq_T B.$$ Is it possible to $\overline{A} \leq_T B$ or $A \leq_T \overline{B}$? Here is my shot. Case 1: $\overline{A} \leq_T B$ This is only possible if $A \leq_m B$ exists and $B=\overline{B}$. As you can transform any many-one reduction to its complement, we can show...
Why can't you just use strongly consistent reads for all your DB reads, with retries on 500 responses? According to CAP theorem increasing consistency should probably lower availability, but can't the decreased availability (increased 500 responses) be handled fairly easily using retries? (assuming you are fine with a ...
Consider the language $\{ uv : \text{$|u| \ge |v|$ and $v$ contains a 1}\}$. I am unable to understand how to accept this language using a PDA. How to check the length condition as well as check if there's a 1 in the $v$ portion? The question has previously been posted here but I couldn't figure out much from the answe...
Let's say a function $f$ is called with parameter $n+1$. Since I use pass-by-value-result, value of formal parameter will be transmitted to the caller's actual parameter at the end of the call. Let transmitted value be 10. What will be the value of $n$? 9 ($n+1 = 10$) or still 10?
Suppose a person has a sequence (S) consisting of integer numbers and would like to split the sequence into a number (possibly one) of continuous parts. For each part independently, I then choose any integer value and removes all occurrences of this value in the corresponding part (note that there could be no such occu...
I am not a computer scientist and this is my first question. This question is a question in layman terms and I also want the answer in layman terms. When I searched hyper-computation. There was a list of models of hyper-computers. Now, my question is that what are the problems with those models and if it is possible to...
It is well-known that many modal logics can be viewed as fragments of $FO^2$, i.e. two-variable first-order logic. But is there a modal logic that is not a fragment, but is expressively equivalent to $FO^2$?
I saw this proof and I wondered if I could prove $E_{TM}$ with Rice's theorem similar to the one described in the answer. Can you do the same thing by letting $M$ to only accept empty strings? (the $M$ that is described in the answer of the proof) So If $x$ is empty, accept If $x$ is any non-empty string, reject.
I am referencing the Book Fundamentals of Computer Algorithms" by Ellis Horowitz et al. At the part which they talk about multi-threading models, user-level and kernel-level thread are introduced. And at the scheduling chapter, under multi-core processors, they talk about software threads and hardware threads. Even tho...
I'm reading The Algorithm Design Manuel and one part is kind of confusing to me The part that's confusing to me is how in the "Proving the Theta" section he proves that selection sort is Ω(n^2). I mean, I understand that for some (c) c.n^2 can be a lower bound for selection sort, however I don't understand how he prove...
I have found an algorithm that runs quite fast on Subset Sum problem few years ago (sometime around 2016). It basically sorts the input set in descending order (instead of the regular ascending) and does the backtracking then to arrive at results. It solves a 1,000,000 instance set in 5 minutes on my i5 8 GB RAM machin...
The first time I heard about functional programming, someone told me "it's more reliable to code in a functional style because your type system is like a proof of correctness". I recently learnt about the Curry-Howard (CH) correspondence and I think this is what he was using as a basis for his assertion about functiona...