instruction stringlengths 35 29.1k |
|---|
Let K players be among N towns in a circular position.
On each turn, only one player can move.
A player cannot move if he is the one who moved in the previous turn.
A player can only move clockwise to the next town, ex from town 0 to town 1, from town T to town T + 1, from town N - 1 to town 0.
Each town at any point ... |
If we know that $n = 1363$ and $φ(n) = 1288$, how can we factor $n$?
|
This question is a simplification of the one about finding the shortest path in a grid with turnstile and waypoints. Since this simplification has dramatic consequences, I think it deserve its own question and answer.
Here's a reminder of how the turnstile tiles work.
A turnstile tile has two bars on adjacent sides of... |
Just to be clear, I am aware that you can define an accepting DFA for every regular language. My problem is a bit deeper.
Let's say we have a language L which consists of a random half of all binary strings of length at most k. This language is finite, so it is regular. We can of course create a DFA for it, by represen... |
I'm trying to make an algorithm that finds the first 10 or so terms of a function's Taylor series, which requires finding the nth derivative of the function for the nth term. It's easy to implement derivatives by following the definition of the derivative:
$$f'(x) = \lim_{h\to0}\dfrac{f(x+h)-f(x)}{h}$$
implemented here... |
I want to prove that the following language is decidable:
$$\mathit{SEQ}_{\mathit{CFG}} = \{⟨G⟩ \mid \text{$G$ is CFG and $L(G) ⊈ L$}\}, \text{ where } L = \Sigma^* - \{\epsilon\}$$
So, I think about the relationship between equality and substrings.
for example, I saw in different questions that when we have $L(G) = L(... |
I recently asked this question and got an answer from Yuval Filmus stating that we can build a solution using error-correcting codes.
More specifically, I'm looking for error correcting codes (for binary alphabet) with constant $R>0$ non-zero relative rate, and as high as possible relative distance $\delta$.
I know tha... |
I need to calculate the expected height of a randomly built binary search tree, BST, with 4 different keys: $x < y < z < w$
According to Catalan numbers, there are 14 possible trees, 8 with height 3 and 6 with height 2. So let $X$ be a random discrete variable that holds the tree height, $P\{X=2\}=\frac{6}{14}=\frac{3}... |
i have a pretty basic question, but for example a cpu clock at 3ghz, does that mean it can do 3 billion cycles per second, or does it every second always will make since 3 billion cycles?
|
What is the asymptotic bound? How do you get to the result?
$$T(n)= 3 \cdot T(\sqrt[3]{n})+n^3$$
|
I am aware that when we have a linear problem subject to OR constraints, the LP would be a non-convex optimisation problem. For example,
${x = 0}$ OR ${1<=x<=2}$.
My question is in such a situation, is it possible to check if an LP is feasible/infeasible, bounded/unbounded or if it has an optimal value or not
I could n... |
I'm trying to solve a scenario where I need to find the smallest number of time steps to reach a location in 2d space, where I can manipulate the velocity with an acceleration at each time step where the acceleration has a maximum magnitude of $n$. This sounds vague, so let me clarify:
I have the following scenario:
W... |
Let $G=(V,E)$ and denote $d=d(G)$ its maximal degree and $a=a(G)$ its arboricity. My question is: what is the smallest amount of colors $f(a)$, such that a $f(a)$-coloring is guarenteed to exist?
For example, $f(d)=d+1$, because a $d+1$-coloring always exists.
My assumption is that $f(a)=2a$. Because each forest can be... |
I was asked this problem recently in an interview however, I failed to provide an optimal solution to it.
Given an array $A$ of $n$ numbers, the magic factor of $i^{th}$ element is
equal to the greatest prime factor $G$ where $G$ is the count of
elements in the array strictly less than the element $A[i]$.
Now, the mag... |
I asked a similar question here, except I forgot to specify that the final velocity must be 0.
I have 2 points in 2D space, start = $s$ and target = $t$, and a starting velocity $v_0$.
At each time step $k$, the current point $p$ (which starts as $s$ and is incrementally updated) has the velocity $v$ added to it, so $p... |
How to prove that in any tree, all longest paths cross one another in one vertex?
|
In terms of the arithmetical hierarchy, the halting problem is known to be $\Sigma^0_1$-complete, and the so-called universal halting problem, is the problem of determining whether a given computer program will halt for every input, is known to be $\Pi^0_2$-complete.
Is there a natural $\Sigma^0_3$-complete variant of ... |
I know that the average access time for systems with level 1 caches is:
Average Access Time = Hit time + (Miss Rate x Miss Penalty)
How can this be generalized for n level caches?
|
The Galvin OS text says that on older systems, there used to be a method, where the entire running process (when in idle state) was moved from the main memory (when main memory ran low) to the disk which acted as a backing store.
The text says that whatever processes we swap out are placed in the "swap space" of the d... |
A zero-sum game for two players allows a player to take no action during a turn. Can I reach optimal play (where both players always choose the best possible action in each turn) by the following scheme?
Randomly choose move orders $A_{1}$: $O_{A1}, O_{A2}, ...$ for player A over turns $1,2,...$
Find player B's optima... |
Our professor talked about the "two" types of embedded systems in today's lecture, listing these.
1.) Baremetal
2.) Full-featured
Now I found out what he means by baremetal, but I can't find anything about "full-featured" in the whole WWW.
What do both terms mean exactly, and how do I distinguish between them? In which... |
I'd like to know if there is any video courses that relate information theory and thermodynamics, e.g. courses cover laws of thermodynamics, Shannon's entropy, Kolomogorov Complexity, Landauer’s Principle, and anything related to them in one course.
Thank you!
|
I made this grammar:
$S \rightarrow ASa$
$S \rightarrow c$
$A \rightarrow a|b$
And I want to check that it accepts words like $aacaa$, $abcaa$, $babcaaa$, I formed the grammar by thinking about the typical $ a ^ nb ^ n $,but I added what is necessary for my interest.
|
We define the triangle factoring problem as in Triangle Factors in Random Graphs, which is, given a simple undirected graph of $3n$ nodes, find if there's a subset of edges dividing vertices into $n$ vertex-disjoint triangles.
I've seen some papers discussing about the probability of such a factoring exists, but I'm un... |
Minimization of any expression of 4 variables through K-map, in which there are more chances of errors (like error in grouping) and the same expression with Quine-McCluskey Method there are less chance of errors but it should be of 4 variables. And I know that Quine-McCluskey Method gives accurate result as compare to... |
I can't figure out how to solve this problem:
Let $b_1,b_2,\ldots,b_k$ be positive integers with sum less than $n$. Prove that $$b_1!b_2! \cdots b_k! < n!.$$
|
Does $NP^{SAT}=NP^{NP}$?
We can see easily that $NP^{SAT}\subseteq NP^{NP}$, because $SAT \in NP$.
But is the other side $NP^{NP}\subseteq NP^{SAT}$ also true? If yes, how can we prove it?
|
I am confused about an aspect of the definition of first normal form in relational database model.
Codd 1970 ("A Relational Model of Data for Large Shared Data Banks") defines normalization (implicitly to first normal form) as "eliminating nonsimple domains", where nonsimple domains are domains which have relations as ... |
Given the following DB and query :
Now if we need to simplify the query qualification, here is the answer from the book (Principle of distributed database systems, third edition) :
My question is in the highlighted bracket, I think this should be (p1 OR (p2 AND (Not p2))) instead of the one written because we have t... |
Consider the computational problems in which the input is a set of $n$ integers with maximum magnitude $M$. According to Erik Demaine's lecture notes, assuming $P\neq NP$, the following are true:
If a problem is strongly NP-hard, then it does not have a pseodupolynomial time algorithm (an algorithm with run-time $\tex... |
Given a graph G and an integer k , recognize whether G contains dominating set X with no more than k vertices. And that is by finding a propositional formula ϕG,k that is only satisfiable if and only if there exists a dominating set with no more than k vertices, so basically reducing it to SAT-Problem.
The solution to ... |
I am trying to create a DPDA that accepts words from the following Language:
$$
L = \{wx \; | \;w \in \{a,b\}^*, \#a = \#b \}
$$
My intuition was to initially put an $x$ on the stack and then write an unlimited amount of $a$ or $b$, while both operations put an $B$ or $A$ on the stack.
Then, in the second last state we... |
Consider a multiset of $n$ integers, where each integer is between $1$ and $3 M$. The sum of all integers is $3 S$. There are three bins. The capacity of each bin is $C = S + M$.
Is there a polynomial-time algorithm to decide whether all integers can be packed into the bins?
To explain why this specific case is special... |
According to google, a system of boolean equations is defined as follows
Essentially, a Boolean equation system is an ordered sequence of fixed point equations over Boolean variables, with associated signs, µ and ν, specifying the polarity of the fixed points. The equations are of the form σx = α, where α is a positiv... |
I was reading a paper for learning graphs (paper is GraphRNN) and it says in section 2.2 (emphasis by me):
Vector-representation based models. One naive approach would be to represent G by flattening $A^π$ into a vector in $R^{n^2}$, which is then used as input to any off-the-shelf generative model, such as a VAE or G... |
Any decision problem algorithm can be represented as a boolean expression. The rules of boolean algebra (De Morgan's law, distributivity, etc.) can be used to manipulate and simplify that expression, similar to normal algebra.
Can any boolean expression be derived to its most simple form (i.e. has the least number of ... |
Given any multivariable expression in Lambda Calculus (LC), e.g. for an arbitrary LC expression "op" for some non-commutative operation:
E = (\x (\y ( op x y ) ) )
Does there exist an LC expression which will transform E into the expression:
F = (\y (\x ( op x y ) ) )
-?
If so, how can such an expression be generaliz... |
I'm working on a suite of DSP tools in Rust, and one of the features of the library is a collection of windowed statistics (mean, RMS, min, max, median, etc) on streams of floating-point samples. For instance, if the window size is 7, then the windowed min is the smallest of the last 7 items in the stream (the window),... |
I know this problem is related to the greedy algorithm and max edges incomplete graph but can't come up with a solution.
Problem
You are given two numbers n and k:
n >= k
n is the total # of vertices
k is the maximum number of vertices that can form a complete graph per second
There are no edges initially
how many seco... |
Is $(\log n)^c = O(n)$ for any constant $c$?
For example, is $(\log n)^5 = O(n)$?
|
I'm solving Problem 14.14 of What can be computed?.
14.14 Consider the computational problem HALFSAT defined as follows. The
input is a Boolean formula B in CNF. If it is impossible to satisfy at least half of
B’s clauses, the solution is “no”. Otherwise a solution is a truth assignment that
does satisfy at least half... |
This is one of my homework assignment questions, that are quite difficult for me.
The question states:
Show that $L$ is not semi-decidable where $L = \{w\#x \mid w,x \in \Sigma^*, T(M_w)\neq \{x\}\}$
So I just need a better understanding of $L$ in order to solve this homework. My question now is:
Is the complement o... |
Let $\Sigma = \{c_1, c_2, R(\cdot,\cdot) \}$ be an alphabet in first-order logic without $=$, where $c_1,$ $c_2$ are constant variables and $R$ is binary relation.
Let $\varphi$ be a formula without quantifiers such that $FV(\varphi)=\{x\}$.
Prove or disprove:
if the first-order sentence $\exists \,x\,\varphi(x)$ is ... |
While reading about 0/1 knapsack problem on the Internet, many tutorials considered value/weight ratio to solve the problem and I was wondering will it always contain the element with the greatest value/weight ratio to find an optimal solution to a 0/1 knapsack problem or is there any example where we find the optimal ... |
I am studying a certain theoretical optimization problem related to scheduling, and I am confused by the different terms used in the literature for such problems. In particular, I found the following terms:
Job scheduling
Machine scheduling
Process scheduling
Processor scheduling
Multiprocessor scheduling
Task schedul... |
How do I describe the following automaton in plain English?
The only thing that I can think about when explaining in plain English would be the states, alphabet, start, accepting state, but I think there is more to when explaining about automata. How do I answer that?
The states are as follows: Q = {q1, q2, q3, q4}
Th... |
I'm having a hard time solving the problem below:
In Claw-free problem, we are given a graph $G$ and $k$, and the objective is to decide whether there exists a subset $S \subseteq V (G)$ of size at most $k$ such that $G \setminus S$ does not contain any $3$-star (known also as a claw) as a subgraph. Design an $O(k)$-ve... |
Is the following line true?
Consider three problems A, B and C. If $A$ $<p$ $B$ and $B$ $<p$ $C$
and $B$ is NP-complete problem, then $C$ is also NP-complete.
If B is NP-complete, then C would have also been NP-complete if it was in NP but it is not given here. Can we consider it false?
Or is there any other reason?
|
Trying to understand how compiler/static-type-checker checks for subtyping, I run into 2 problems.
1. Reachability in DAG
Since both Python/C++ support multiple inheriatnce, the types can be represented as a DAG.
A C
| / \
B D
|\ |
E F /
| x
| / \
G H
Now is_subtype(A,B) -> bool becomes the problem of reach... |
if a lexical grammar has multiple token which start with the same character like > >> >>= and their longest length is 3, does it have 2 character lookahead?
Or is it implementation defined. Does the number of character required to produce a fixed size token like a keyword - 1 also count.
What is the formal definition o... |
We are given a synchronic undirected tree shaped network, with $n$ indexed nodes.
We know that there is at least one node with at least $\log_k n$ neighbors, $k>1000$, and $k$ is given.
We need to divide the network into $\log_2 n$ distinct groups, with at least one link between any two groups, and each node has no mor... |
I need to give a parallel algorithm which finds the minimal element of an unsorted array. Moreover, I need to show that $T_1 = Θ(n)$ and $T_∞ = Θ(\log n)$.
As I read $Θ(\log n)$, I thought about some sort of divide and conquer algorithm, like MS:
parallelMin(A, l, r):
if l ≥ r:
return min(A[l], A[r])
m ... |
I was recently learning about Binary Search Trees(BSTs) and thought it could be made even more efficient by making some changes.
As binary search trees have numbers greater than the root node on the right and the numbers lesser than the node on the left, we can further divide the tree into odd and even numbers to make ... |
This is an intriguing question given by my friend for which I want to find an optimal solution:
Each week, you can choose to work ONLINE $(ON)$ or in person $(WR)$ in
your department's office. If you attend work online in week $i$, you
will spend $ON_i$ hours; otherwise, if you attend work offline in the
department, y... |
Out of pure curiosity, if I have a Doubly Linked List, what would be the fastest way to return the elemenmts of the List in the correct order as an array? For example, would it be more efficient to create an empty list an append the elements or create a list with the length of the Linked List and insert each element?
|
I have doubts regarding a proof of the following theorem:
'Set of all problems' is larger than the 'set of all algorithms' (or set of all C programs).
Put rhetorically, the theorem says that there are more problems than there are solutions.
The proof is by cardinality comparison of the two sets and has the following st... |
We all know that:
Every graph has an MST. The MST need not be unique, but it is unique if all the edge weights of the graph are distinct.
But if the weights of the edges in a connected graph are not all distinct, does it mean that there is more than one minimum spanning tree?
|
Let $X=R^3$.
Let $C=H=\{h(a,b,c)=\{(x,y,z) |x|\leq a,|y|\leq b, |z|\leq c\}, a,b,c\in R_+\}$ the set of all origin centered boxes.
Describe a polynomial sample complexity algorithm that learns $C$ using $H$.
Can you please explain what does it mean to describe an algorithm that learns $C$ using $H$?
What is the differe... |
Sorry for bumping this very old problem which already has answers on multiple SE sites, but I just cannot understand any of the answers.
Let $\Sigma_{bool} = \{0, 1\}$.
Then, $(\Sigma_{bool})^*$ is the set of all binary strings, as far as I know. I've seen many posts claiming this set is uncountable. But how is that po... |
The Dijkstra's algorithm is never used for a graph with a negative weight.
The following graph has negative weight but when the Dijkstra's single source shortest path algorithm run from vertex a, it computes the correct shortest path distance to all the vertices.
But when I solve it for the following graph:
I am not ... |
Let's say I have a bunch of lists of real numbers which we'll call a, b, c, etc. Moreover, let's say all of these vectors are correlated, in the sense that a[1] < a[2] implies that there's a better-than-even chance that b[1] < b[2]. I want to sort each one of these lists individually, returning a', b',... with the same... |
Consider the standard $k$-center problem i.e find $k$ disks of radius $r$ that cover all points in a point set $P$. This problem has a well known greedy 2-approximation algorithm where you (essentially) choose points from $P$ as the centers of each of the $k$ disks and each time you pick a point you pick the one that m... |
Let's say, if you could travel to the past, what would you teach your younger self? Which key points define efficient algorithms?
|
Can D simulated by H terminate normally?
The x86utm operating system based on an open source x86 emulator. This system enables one C function to execute another C function in debug step mode. When H simulates D it creates a separate process context for D with its own memory, stack and virtual registers. H is able to si... |
I found an implementation of suffix arrays here (not sure if it's the most efficient so if there's any better I'd be glad to know).
For a given string:
data = '1034408'*10
It generates the following suffix array:
suffix_array = [64, 57, 50, 43, 36, 29, 22, 15, 8, 1, 68, 61, 54, 47, 40, 33, 26, 19, 12, 5, 63, 56, 49, 4... |
I need to come up with an algorithm that finds differences in the sequence of each product's routing (or sequence of processes).
There are several processes aligned together and each process's been operated under specified equipment.
For example,
if there are four processes(A - B - C - D) until the final product and in... |
I was reading the paper on SMA*+, which is very interesting as it implements most improvements I thought of when reading the paper on SMA*. But I have 3 questions that I think are related to my misunderstanding of the cost evaluation of the re-generated nodes.
Can there be some memory saved by not fully expanding a nod... |
In the report "Shared Memory Consistency Models: A Tutorial" (https://www.hpl.hp.com/techreports/Compaq-DEC/WRL-95-7.pdf), the authors explain the difference between IBM370, Total Store Ordering, and Processor Consistency via Figure 10 (shown below).
I do not understand why the results for (a) are not possible with IBM... |
Let's say I have a struct Product with an unknown and variable amount of attributes-values. The attributes-values come from a user at runtime. One product with a unique combination of attributes and values form a product_variant.
For intance, user may create 4 attributes:
size (5 values)
material (3 values)
design (2 ... |
The paper on SMA*+ proposes a very interesting idea of having a culling heuristic different from the full path cost estimation (so called $f$-cost).
In the benchmark they use a culling heuristic equal to the $f$-cost: $c(n) = f(n)$. And I actually can't think of a valid reason to do otherwise. Ever. Are there really ca... |
There are 25 lights $\{l_1, l_2, \dots , l_{25}\}$ in off mode. On Day 1, every light is on. On the Day 2, every 2nd light. i.e, $l_2, l_4, \dots , l_{24}$, are off. On the 3rd day, every
3rd, i.e., $l_3, l_6, \dots , l_{18}$, are toggled (switched on if it is off/switched off if it is on). This process continues for ... |
Informally, we want to partition the edges of a graph into a few cliques. Given $G=(V, E)$, we want to find subsets $V_1,\dots, V_k\subset V$ such that $E = E[V_1]\dot\cup \dots \dot\cup E[V_k]$, where induced subgraphs are complete $E[V_i]=\binom{|V_i|}{2}$, and we want to maximize $\sum_i \binom{|V_i|}{2}$.
Is there ... |
What's the difference between a protocol and a distributed algorithm? My internship supervisor told me they are not exactly alike.
A protocol is more communication-oriented (e.g. TCP), whereas a distributed algorithm allows more complex interactions (e.g. a cryptocurrency system).
However, I still can't fully grasp thi... |
So would it be correct to say that the number of comparisons from level 1 to level 2 would be $2(n/2-1)$?
Or would it be more correct to say that the number of comparisons is $2^i(n/2^i-1)$?
|
I'm facing a task similar to what filesystems do. I have a bunch of continuous allocated space and I need to place pieces of variable length data into it, each piece of data can change size over time.
Now I could just place the pieces one after another as they come, then when they grow too big to fit I'd fragment the ... |
Say I have a for loop like this
for(int i=1;i<n;i=i*2)
{
for(int j=1;j<i;j=j*2)
{
cout<<"hello";
}
}
What is the time complexity of this loop?
I have approached this problem like this. The outer loop runs log(n) times and the inner loop runs log(i) times, so in total the complexity becomes $O(log(... |
I have a tree on $n$ vertices. Your goal is to find the adjacency list for it.
$n$ is known to you from the start. You can pick a vertex and ask for the lengths of the shortests paths from it to the other $n-1$ vertices (i.e. you input an integer $1\leq i \leq n$ and get $n-1$ integers $1\leq d \leq n-1$). The lengths ... |
So I want to prove that $$ \big\{\langle M \rangle : \text{ M is a TM and } L(M) \text{ is decidable} \big\}$$ is undecidable.
To do so I want to reduce it from$\ \overline{A_{TM}}$ with a function which looks like this :
On input $\langle M,w \rangle$ run $M$ on $w$, if $M$ accepts $w$ output $M'$ where $M'$ should be... |
When you perform a write on a multi-cpu system, relevant cache flushes are done to ensure that the other cpus see the change immediately.
BUT
That write was issued from an independent thread on a preempting operating system, so there never was any expectation that it would arrive at any particular time. All that cache... |
Assuming we have two trains that start in one source edge. I want to find an algorithm that finds two paths for these trains so that they won't meet in an edge at any given time. So we have the train ride T=$ \left(\left(v_{i-1}, v_{i}, t_{i}\right)\right)_{i=1}^{k}$, starting in v_0 to v_k and t_k as the arrival time.... |
I want to solve this problem using Many-One-Reduction, which involves, if I understood it correctly, reducing another problem on the problem stated in the title, i.e.
$$
H \leq_M L
$$
I would try reducing the Halting problem $H$ onto $L$, because we know that $H$ is not decideable. Would this be the correct approach? I... |
Let's say we have a b tree of order 4 and it has 3 levels. All nodes are completely filled. Now if we want to insert a key with maximum value ( than all keys present in the tree). For this, we have to go to the rightmost node at the last level. As this last level is also filled, now how can we proceed further as all th... |
I wish to approximate a sequence of rational numbers using a linear recurrence of order $k$ for some small $k$ (preferably as small as possible). The Berlekamp-Massey algorithm solves the exact version of this problem, finding the optimal such $k$, and even the coefficients of the linear recurrence generating the seque... |
⌊1/⌋ - represents the floor function Does the floor or ceiling function affect the complexity under which a function falls?
⌊1/⌋∈Θ(1/) or to Ω(log)
Found this interesting question in a Cornell paper
Thanks
|
I am working with a toy programming language for my thesis. It is lazy evaluating so I can have infinite terms (for example the "infinite natural number" inf := S(inf)).
There is a proof assistant build into my language so I want to write down denotational semantics for it.
Now I want to describe a Herbrand universe f... |
The following is the solution to an exercise in the book CLRS.
The question: Give a linear-time algorithm that given a graph G and an integer b, determines whether the value of the bottleneck spanning tree is at most b.
The algorithm:
To do this, we first process the entire graph, and remove any edges that have weight ... |
I am trying to verify whether it exists a path from $a \in A$ to $b \in B$ whose length is $\ge k$ in $\Theta(G)$.
This is what I have done:
Algo(G,A,b,K)
Init(G) // colour[v] = WHITE for all v in G.V
for each a in A do
if colour[a] = WHITE then
dist = BFS(G,a)
for each b in B do
if colour[b] = BLACK then
... |
Alghorithm : Quick sort .
idea : devide and conqure .
steps :
1- find the pivot point from array like first element .
2- partiotioning the array so that elements are smaller than pivot point are in the left side and ones are bigger in the right side .
3- sorting both sub arrays (recursion)
Question : i know all of the... |
This is an issue I encountered on several applications with different variants. But here is the common base for which I suspect to miss a more efficient approach.
There are $K$ different tasks to schedule on something (a product, some data, whatever...). Any order of actions is acceptable, but the cost (in time for exe... |
Concerning modern computers communicating with each other it is my understanding that computers are reading patterns in current flow and interpreting those patterns of current flow as ours 1's and 0's.I make the following assumptions here.Whether hard wired or wireless the communications start and end their journey as ... |
Prove or Disprove: There is $\boldsymbol{no}$ alphabet $\Sigma$ and closed formula (no free variables) $\varphi$ above $\Sigma$,
such that for any Model $M$ it holds that
$M\models\varphi\iff\,|D^M|=\infty$.
I'm not sure what is the classic way to approach this. I do think that the statement is correct. I tried the n... |
If so, for any OS more than 10gb, how does it run on a computer with limited ram like 4gb? If not, which part of OS is copied to the ram? Or is it dynamically loaded whenever certain part is needed?
|
Recently, I started to think of a problem involving the use of Twitter data that would involve finding pairs of users that participate in the most conversations. For example, with each tweet, you get the root conversation id along with a user id for that specific tweet. What I want to do is find pairs of users that par... |
My understanding is that in a programming language, built-ins are bindings that exist without the user having to make them. (Like + to its referent, for example.)
My understanding of a constant literal is that it is a variable whose name encodes its value. (Like 3, or {"Name": "Steve", "age": 47} in JS.
Is a constant l... |
If not, then why aren't all the pages loaded into the TLB so that TLB misses never happen.
|
My idea is to initialize a hash table (with chaining) with $n$ cells, having load factor $\alpha = 1$ hence having $\theta(1)$ expected number of values in each cell in the hash table, then go cell by cell, sort it, count the number of distinct values and add them to a global variable holding the count and return it.
T... |
Let's suppose that we have a light source. Which of the following are correct for the tree of recursive ray-tracing (ray tree) that create when we make the colors for each pixel in the screen.
Which of the following are correct:
a) if the scene contains one non-convex polyhedron (random shape and position) then we can'... |
I'm very stuck with this problem. Given $G = (V, E, A)$ a mixed graph where every edge in $E$ is directed and every edge in $A$ is undirected. Thinking as a max-flow problem, decide if it's possible to give a direction to every $a \in A$ in order to make $G$ an $eulerian$ graph.
The model I've thinking so far is to tra... |
Let's say I have $n$ sets of matrices
$$
A = \left\{\begin{pmatrix}
2 & 4 & 17\\
5 & 6 & 9\\
\end{pmatrix}
\begin{pmatrix}
2 & 4 & 18\\
5 & 6 & 9\\
\end{pmatrix}
\right\}
$$
$$
B = \left\{\begin{pmatrix}
13 & 20\\
3 & 16\\
\end{pmatrix}
\begin{pmatrix}
14 & 20\\
3 & 16\\
\end{pmatrix}
\begin{pmatrix}
13 & 21\\
3 & 16\\... |
In quick sort, in each iteration we are able to find correct index for an element (i.e. pivot element).
Is there any algorithm to find correct element for a given index ?
Here, correct index of an element means the final index of the element which would appear after sorting the array.
Reference:
https://en.wikipedia.or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.