instruction
stringlengths
35
29.1k
I just built a LRU cache that combines a hash table and a double linked list. To me it was a brilliant idea to combine those two structures and use the strengths of each together, so it got me thinking, can people or do people combine hash tables with other more complex data structures like trees and graphs? Are there ...
I need help proving the following fact: Let $G$ be a random $d$-regular graph with adjacency matrix $A$. The smallest eigenvalue $\lambda_n$ of $A$ should satisfy $|\lambda_n| = o_d(d)$. (In particular, I think $|\lambda_n| = O(\sqrt{d})$.) Exercise 7 in [1] is to prove this fact, so it seems like there should be a sim...
Consider the fact that each player can either sit on their desired chair or on the neighbouring chair. Two configurations are distinct if at least one person is sitting in another chair. My attempt For example, if there are 4 players sitting around a circular table there can be 9 distinct arrangements. F1,F2,F3,F4 F2...
I have found two interesting questions regarding the quotient of languages, described as: $A/B = \{ w \text{ | }\exists z \in B, wz \in A\}$ The first one is: Let $A$ and $B$ be regular languages, prove that $A/B$ is decidable By using the proof from this other question, it can be proved that $A/B$ is regular if $A$ ...
I'm working on a problem 2.3a in Shalev-Shwartz/Ben-David's Machine learning textbook, which states: An axis aligned rectangle classifier in the plane is a classifier that assigns 1 to a point if and only if it is inside a certain rectangle. Formally, given real numbers $a_1\leq b_1, a_2\leq b_2,$ define the classifie...
The problem. Let us consider a huge file with billions of lines, each containing a string. There are $n$ different strings and $m$ lines in the file, with $m$ much greater than $n$, although both are huge. In particular, neither the entire file nor the list of all distinct strings fit into central memory. The global fi...
I have a very poor understanding of gray code in general and I find it to be a difficult thing to learn. While trying to learn about it I stumbled upon this seemingly looking trivial question that I can't answer. Can the bit pattern 01110011 represent offset gray-code? What is "gray-code" and how do I construct it and ...
I have implemented Thistlethwaite's algorithm however, it is far too slow as it is only using graph traversal over many Rubik's cube states. I am currently unsure of how look-up tables are implemented so any help on how I could do so would be greatly appreciated.
I'm an igsce student. I'm taking computer science as an OL subject this year. Pixels are the small squares which make an image. Inside each pixel there are 3 channels: one for blue, one for green, one for red. The three primary colours from which any other colour can be made. And that's how I imagine it: When we say an...
The address bus(of cpu) is connected to a digital decoder inside the memory which sets 1 pin logic high and activates the read/write operation of the memory let's say DRAM. Is the data bus(of cpu) connected directly to the bit line of the DRAM(columns) or are there some in between steps?
I'm trying to understand the statement of the Goldwasser-Sipser Set Low Bound Protocol as presented in "Computational Complexity: A Modern Approach" by Arora and Barak. In particular, I'm trying to understand why the following claims yield what we would want: $S \subseteq \{0,1\}^m$ is a set such that members can be ce...
I want to make sure my understanding on P vs NP is correct. I know that NP-complete problems cannot be solved in polynomial time, and if P != NP, then all problems in NP cannot be solved in polynomial time. Furthermore, if we consider the church turing thesis, and if P != NP, then no computational formalism can solve N...
I found in some exercise in computation the following step: I can't understand why is it equal terms, based of what I know about De morgan's law: OR should be replaced by AND where $w=\varepsilon$ come from
We are given an Undirected, Weighted and Connected Graph $G$, (non-negative weights, all distinct) with one property that shortest path between any two vertexes on this graph is on MST. The following Facts is False, and True. $I$) Graph $G$ is a Tree. False. $II$) weight of each ${u,v}$ edge, is at lea...
This problem is a mix of the bin-packing and the knapsack problems. I call it "the moving van problem": there is a moving van with a limit on the weight it can transport, and a set of boxes that you want to fill with valuable objects to be transported in the van. Both the boxes and the objects that are available can be...
In an online discussion on Turing machines and decidability recently, I blatantly theorized that any problem about a specific single Turing machine must be decidable, the question of undecidability only arises when we are talking about a class of a problem. As a rebuttal to the original argument someone replied that if...
In mathematics and computational geometry, a Delaunay triangulation for a given set P of discrete points in a plane is a triangulation DT(P) such that no point in P is inside the circumcircle of any triangle in DT(P). A Voronoi diagram is a kind of tesselation that divided the medium into polygons in 2D and polyhedrons...
As is well known, there is no single procedure for deciding whether any given Turing machine halts on an empty input tape. This is easily shown, e. g., by applying Rice's theorem. But what if, instead of considering the entire set of Turing machines, we only focus on a subset thereof? Clearly, if the subset is finite, ...
Problem Below is a program named X: y = 1; while(y < x){ y = 10 * y; } What does this program X do? What are appropriate pre and post conditions? (Assume that x and y are integers). My solution Given a whole number x > 1, X should give us a power of 10 greater than or equal to x. pre-condition: (|x = x0 ∧ x0 > 1...
I want to optimize an algorithm for calculating $g(n)=\sum^n_{k=2} p(\Omega(k))\Omega(k)$ where $$ p(n) = \begin{cases} 1 &\text{if $n$ is odd} \\ -1 &\text{if $n$ is even} \end{cases}$$ and $\Omega(k)$ is the prime factor counting function or more exactly, I want to optimize calculating all its values up to $n$ My c...
Problem: A segment of a program is shown below: ⋮ _ _ _ _ _ _ z = x - 7; (|z = 5 ∧ n = 4|) ⋮ What is the dashed line hiding? My solution: I think the dashed line is hiding: (|x - 7 = 5|) However, I am not sure if it is the correct solution, it would be nice to know how to solve this trivial problem.
In our lecture it was proven that WHILE-Programs are turing-complete. In short a WHILE-Program only allows the following: Variables x1,x2,... (initially all 0 and can only be positive) Constants c 0,1,2,3,... Assignment xi := c Addition/Subtraction xi := xj + c, xi := xj - c while-loo...
I want to show that there is a polynomial-time reduction from the standard $\text{Clique}$ problem to the $\text{N-Degree-Clique}$ problem, where: $$ \text{N-Degree-Clique} = \{ \langle G, k\rangle: \text{$G$ has a clique of size $\geq k$,} \\ \text{and every vertex of $G$ has degree at least N} \}$$ I am not sure how ...
I have created a custom implementation for PriorityQueue using max-heap and everything works fine. But now i want to change it and keep only the k highest objects in the heap after every insertion. I have to use only one instance of my PriorityQueue and no other helping data structure. So my problem is how should i kno...
lately, I have encountered a problem that I struggle to find a satisfactory solution for. I need to prove that triangle-free 3-colorability is NP-complete. Therefore I assume the right way is to find an NP-complete problem and reduce it to my problem. I tried it with general 3-colorability, but I was unable to create f...
I have a taxonomy (tree) of product categories. To each leaf product category, I have assigned a shop department where the products of a given category can be found. Now for each department, I would like to find the smallest number of the largest subtrees in the taxonomy. For instance, in the example below leaf nodes h...
I have a grammer with the following productions, S -> aA | bC | b A -> aS | bB B -> aC | bA | a C -> aB | bS I have to construct regular expression for it. I derived words for this language and which are b, aab, aba, baa, bbb, aaaab, aaaba, aabbb, abaaa, baaaa, ... So after I deriving the words I concluded that it's...
I am using Christofides' algorithm to calculate the best route from one location to another given multiple nodes on a map that the route must pass through. The last step in the algorithm requires the route to connect back to the first node, right? Is this step necessary? If no, why? Edit: I essentially want the data th...
Assume that we are given an undirected graph $G$ of n vertices. For this graph, we also know that there is a clique of size $c$, for some $c\geq \lfloor n/2 + 1\rfloor$. In other words, the majority of the vertices will belong to this clique. This clique may or may not be maximal; however, given these assumptions it wi...
Problem description We are given two sorted arrays of even numbers: A and B. Values of A are generally supposed to be smaller than values of B. So we are asked to find a value X where X is an odd number to predict which set an element belongs to. If an element is smaller than X, it will be assigned to A,and if it is bi...
When looking at hashing, and given the following question: Given ASCII values: a = 97, b = 98, c = 99, d = 100, e = 101 Given keys: {e, ae, be, ce, de, abe, ace, ade, bae, cae, dae, bce, bde, cbe, dbe} If we choose: h(k) = k mod 2^6 to map these keys to hash tables indexes, what do you notice? The answer to this is ...
To the best of my understanding, $m \models p$ asks whether the LTL formula $p$ satisfies the LTL formula $m$. In other words, $m \to p$ is a tautology. Here are some examples of where $m \models p$ holds: Xp |= Fp q |= p U q Gq |= Fq Of course, trying to visualise all this in you head and trying to work out if $m ...
Given a tree $T$, I want to find a subset $N$ of $n$ leaves that are farthest apart. I.e., I want to find $N$ that maximizes function: $$f(N)=\sum\limits_{x_1,x_2 \in N, x_1 \neq x_2}{dist(x_1,x_2)}$$ where $dist(x_1, x_2)$ is the number of edges in a path between two vertices/nodes $x_1$ and $x_2$. What algorithm can ...
After asking another question(Is the last step in the Christofides' algorithm necessary), I have decided Christofide's algorithm probably doesn't solve the problem I'm facing. Is there any algorithms that would best suit this problem? The input is a set of nodes on a graph (an implementation would be similar to the il...
I wonder why do we say $\log n$ is the best possible approximation factor for Set Cover Algorithm? We already know there exists a 2-approximation algorithm for vertex cover, which is obviously better than $\log n$. So we can use Vertex Cover algorithm to solve Set Cover problem and get a better approximation ratio. Can...
I'm looking for an algorithm which takes spherical coordinates (say lat-long) and identifies which face of an icosahedron a ray moving in that direction would intersect. My end goal here is to explore various cartographic map projections from a sphere onto an icosahedron (ex: Gnomic, Fuller Dymaxion, Snyder equal-area)...
Can there exist a language L in PSPACE such that L isn't PSPACE-hard and L isn't in the polynomial hierarchy (PH)? Intuitively, it seems like the answer is no, since TQBF is PSPACE-complete, and any version of TQBF bounded finitely to i alternating quantifiers is complete for one part (depending on whether it starts wi...
In my uni lecture, I am covering address decoding. I understand that memory addresses are decoded to find if they point to the RAM, ROM, or I/O, by way of the address (in the example of BBC Micro) being in the RAM range, user ROM range or OS ROM range (e.g. 0x0000 to 0x7FFF is the range of RAM in the address space). Ad...
For this exercise the pumping lemma should be used. My instructor gave me a tip it should start with $w:= a^{prime(n)}$ where prime is a while program returning the nth prime number. This does make sense to me since a while program always returns an element of the integers. How can I use code in my proof?
I'm trying to prove that the language $L \cup A$ is undecidable, when the language $L$ is undecidable and the language $A$ is finite or decidable. This is confusing me because if $L$ were to be a semi-decidable language, then this would be easy to prove (with either pseudocode or TMs), but as I understand not all undec...
Given a Lambda Expression Term T can it be beta-equal to two different Lambda Terms T1 and T2, both T1 and T2 are in beta-normal form?
I found the following question with an answer here, but I can't understand the steps of the solution. Show that if a language $A$ is in RE and $A \leq_m \overline{A}$, then $A$ is recursive. Solution. Since $A \leq_m \overline{A}$, it follows that $\overline{A} \leq_m A$, and since $A$ is in RE, it follows that $\ove...
Preparing for the next semester, I wanted to give the following as a homework question, yet after a few attempts, I failed to solve it. Given a language $L\subseteq \Sigma^*$ and two words $x,y\in \Sigma^*$, define the language $L_{x,y}$ consisting of all the separating suffixes of the words $x,y$ relative to the Myhil...
I have this graph It shows a graph of a map that has nodes and segments (or edges), with weights, that connect these nodes. Some of these segments have addresses on, and some of these addresses are designated as restaurants. There are two chosen restaurants, and one chosen address. Can someone point me in the directio...
I need to construct linear bounded automaton for the language $L = \{ a^{n!} : n \geq 0 \}$. I know how LBA functions, however, I don't have a thought how it can check the n! that to in the power of a. I might want to hear a few suggestions, as I am experiencing difficulty in developing the specific LBA for it.
How would you go about showing that the language L={⟨M,w⟩ | M moves its head in every step while computing w} is decidable or undecidable? Intuitively speaking I think it is indeed undecidable because there seems to be no limit to the possible configurations, however I am not sure. Thanks a lot in advance!
Let $\ f_1, f_2, ... f_m : \{0, ..., m \} \rightarrow \mathbb Z $ my task is to find an algorithm that find a series of numbers $\ x_1, x_2, ..., x_m \in \{ 0, ..., m \} $ that maximise $\ \sum_{i=1}^m f_i(x_i) $ and subjects to $\ \sum_i^m x_i \le m $ To be honest I can't really wrap my head around this problem. Any s...
The "Superset Existence Problem": Let there be a set $S$, and $x$ subsets of $S$. Does there exist a set of size $y < |S|$, which is a superset of at least $z$ of those subsets? To me, this feels like it should be NP-complete (in $|S|$), since it seems intuitively related to covering problems and minimum $k$-union. But...
Assume that Problem $A$ is polynomial-time reducible to problem $B$. Claim 1: If problem $A$ is NP-hard then problem $B$ is NP-hard. Claim 2: If problem $B$ is NP-hard then problem $A$ is NP-hard. Claim 1 is obviously true, but why the second one is false?
I have a balanced $k$-ary B-tree with $N$ leaves (where N is a power of $k$ for simplicity) and I need to simultaneously locate $\ell$ leaves in it. What is the expected number of nodes I will need to traverse? Obviously for $\ell=1$ we need to traverse $\log_k N$ nodes, but the question becomes less trivial (for me) f...
I've been fiddling with software development for a couple of years and in trying to get into the gist of things I came across SICP, which uses Scheme. Basically what I want to do at this stage is to store exercise/test .scm files for study. Should I use Emac or Dr. Racket ? Or none of those? Thanks!
Let's say you are using a messaging application (Microsoft Team, Skype, Telegram,..) on an operating system (Windows, MacOS, Linux). Does the OS know what you are sending or receiving? If yes, how? Assuming that the computer can be setup for monitoring (e.g. company's computer).
I'm looking at a special version of SAT in which each clause has exactly $n/2$ literals, where $n$ is the number of variables. Can we prove NP-completeness of SAT in this case? I tried reducing 3-SAT to it by expanding, but this introduces $2^{k-3}$ extra clauses per original 3-SAT clause, hence the reduction is not po...
I need to prove that the following recurrence relation is $O(5^n)$: $$ T(n)=5^n+3T(\lfloor n^\frac{2}{5}\rfloor) $$ And $T(n)=\Theta(1)$ for $n\le 9$. I am trying induction, and proving that there exists $c$ such that $T(n)\le c\cdot5^n$, but I am stuck at the induction step: $T(n)=5^n+3T(\big\lfloor n^\frac{2}{5}\big\...
More specifically the problem says: "Let us call the set of decidable languages D. Show that NP ⊆ D" My problem is that I always assumed that NP is decidable, but to prove it, I never thought it Somebody have any idea about how do it? or start resolving it? I think I can prove it saying something like the NP problems e...
I thought to reduce from the halting problem to conclude undecidability, yet I don't know how to do it. Perhaps the problem reduces to other decidable problem, and thus it is also decidable?
https://prototypr.io/post/gpt-3-design-hype/ Has GPT-3 had any effect on the how many humans are hired to do web design yet?
In the question in this video about quicksort luckily picking the median in each recursive call. Tim Roughgarden, the presenter, says at 11:22 Partition needs really linear time, not just $O(n)$ time. What does he mean here? I thought linear time is $O(n)$. Does he mean $\Theta(n)$ or something else? I see how partit...
I am trying to solve the following recurrence $T(n) = 4T(n/2) + n^3$ with substitution method. My guess is $T(n) = \Theta (n^3)$ (I used master theorem) and I tried to show that $T(n) \leq cn^3$. But, when I substitute I got $T(n) \leq c \frac{n^3}{2} + n^3$ and that's it not the exact form of the guess, so it doesn't ...
I have come up with a simple technique of approximating the Levenshtein distance between two binary strings using the fast Walsh–Hadamard transform: given two binary strings $a,b$ with Walsh–Hadamard transforms $\hat{a},\hat{b}$ of length $n_a,n_b$, I propose to approximate the Levenshtein distance by $$ \max \{ |\hat{...
I have a homework question that I trying to solve for many hours without success, maybe someone can guide me to the right way of thinking about it. The problem: We want to find an optimal local alignment of two strings S1 and S2, we know that there exists such an alignment with the two aligned substrings of S1 and S2 b...
A graph with n vertices, no matter directed or not, may have maximally 2^n-n-1 negative cycles (Think about combination of 2 to n elements and you'll figure out why 2^n-n-1. A graph that has no graph loops or multiple edges is my only concern) and I want to find ALL of them if any, not just one of them. There are only ...
Given a list of subsets $S_1, \ldots, S_n$ of the universal set $U = \{e_1,\ldots, e_m\}$, find a subset $S \subset U$ of size $k$ that contains the maximum number of subsets $S_i$. In another words, $$\max_{S \subset U\\ |S| = k} \sum_{i = 1}^n \mathbb{1}_{S_i \subseteq S}$$ Where $\mathbb{1}$ is an indicator function...
Given an undirected graph $G=(V,E)$, describe an algorithm that computes an orientation of $E$ such that each vertex has out-degree at least 3. I know how to check if a vertex $v$ has at least $k$ edge-disjoint paths to any other vertex (using Ford-Fulkerson), so I thought I may use that for $k=3$. Would appreciate y...
I recently solved the basic problem of generating a n-bit Gray Code. The solution I used involved building larger-bit Gray Codes from smaller ones recursively (the solution I've seen on most websites). However, I then had an idea for a Greedy Gray Code Algorithm: Start the Gray Code at 0 and at every step, find and cha...
From a youtube video, this PDA can recognize any palindrom. However, from wikipedia, here is one of the criteria of PDAs. We clearly see that the transition function can't take an empty stack as input, as epsilon is not a part of Gamma. (but it can use it as output, and also epsilon input is allowed as we see in the ...
So I am using A* pathfinding to find a path from a person, to a node on a graph. This person has a few 'must pass' nodes that they must go through. So my solution was to run the algorithm for each of the must-pass nodes, to make sure they always go to each of these. My method for deciding which order nodes come in for ...
In my logic class we started learning about the different complexity classes. In particular, we focused on the NP complexity class. A problem is in NP if it is solvable in polynomial time using a nondeterministic Turing machine. To show that a problem $L$ is NP-compelete, we have to show that: $1)$ $L$ is in NP, and $2...
I have got to write an algorithm programatically using haskell. The program takes a regular expression $r$ made up of the unary alphabet $ \Sigma = \{ a \} $ and check if the regular expression $r$ defines the language $L(r) = a^{*} $. I am looking for any kind of tip, I think I can use a pumping lemma somehow, but I ...
I can't find this anywhere online. Is bitcoin mining NP-Hard? If so, how would we be able to prove a reduction from a known NP-hard problem? I am a bit lost.
I am a bit confused about how the logical addresses are generated in a paging memory architecture and where and when a program is split up into pages. I understand how logical addresses are translated to physical addresses and everything that happens after that. I just don't understand how a program is split into disti...
How is a conditional branch instruction implemented in hardware? The instruction checks the sign bit, how does it decide to load pc with the branch address or increment pc to the next sequential address?
I have faced the following problem in an entrance examination, and need to verify a few results plus a question part that did not manage to get in time. Given an array $A$ of length $n$ which contains all integers $1,\ldots,m$, the goal is to find a consecutive subarray of $A$ containing the integers $1,\ldots,m$ which...
Given a network flow and there exists (u,v) edge with positive capacity and there is not path from $s$ to $u$. and $(u,v)$ is with full capacity in some maximal flow. I've had this questions with true or false and I thought it was false but apparently it is true. Can someone please explain me how this is possible?
This question seems to be causing a lot of debate and I'm wondering whether my working is correct. A computer with a single cache (access time 20ns) and main memory (access time 500ns) also uses the hard disk (average access time 0.01ms) for virtual memory using paging. If it is found that the cache hit rate is 95% an...
To begin with, consider two persons(Px and Py) are playing a game. Px is the organiser of the game who has n sticks of distinct lengths and displaying them one by one to Py in a random order, with each order being equally likely. Given the fact that the lengths of sticks are not known to Py in advance. On each step, Py...
I have an example: m = n = p = (-1) ^ (m + n + p) * (m + n + p); I don't know what to do with multiple "=". Should I treat them as a sign with the lowest priority or just put them in end of the answer? That's what I get when I treat them as sign with the lowest prioryty: M,N,=,P,=,1,NEG,M,N,+,P,+,^,M,N,+,P,+,*,= Could ...
Given an undirected graph $G=(V,E)$ a Gomory-Hu tree $T$ for $G$ has the following properties: $T$ has a node for each vertex in the graph G and each edge in the tree corresponds to a minimum cut separating the corresponding pair of vertices of G. $T$ has the property that the minimum cut between vertices $s$ and $t$ ...
I have found an exercise where it tasks to provide a grammar and a pushdown automata for $L = \{ 0^x1^y0^z1^w | x+w=y+z\}$ While finding a pushdown automata for it is quite easy (four states and two stack symbols $p$ and $t$, where $0^x$'s push $p$, $1^t$'s and $0^z$'s pop $p$ or push $t$ if there are no $p$'s, and $1^...
I know the working of 2-opt and 3-opt local search algorithm. But I could not find any example where solution improvement is not possible using 2-opt but 3-opt. I am looking for a proper explanation along with diagrams where TSP solution is not improved by 2-opt but 3-Opt can improve it.
I am amazed by the many discussion regarding the existence of any linear and in-place sorting algorithm, and variants, see e.g. is-this-implementation-of-bucket-sort-considered-in-place is-counting-sort-in-place-stable-or-not sorting-in-linear-time-and-in-place can-a-counting-sort-be-considered-in-place-when-the-proble...
Does the cpu interface with a memory controller to read the cache? What happens when data is not in the cache, a cache miss, does it automatically fetch the data?
In a cpu with segmented memory, can an address only be accessed with a segmented address, or can a normal virtual address also be used?
Suppose there is a polynomial time reduction from problem $A$ to $B$. Why is the following false? If $B$ is NP-hard then $A$ is NP-hard. Can some explain this intuitively?
I know some basic machine learning and deep learning. Now a days deep learning solve many types of problem. I working working optimization problem like np, np hard problem. Is there any hope to solve np hard problem using deep learning
Depending on the API/language you use, splitting the string "ABCD" using "" as a delimiter gets you: ["A", "B", "C", "D"] in Java, Javascript, and Go ["", "A", "B", "C", "D", ""] in Rust ["ABCD"] in C# Fails with an Exception in Python3 From the perspective of formal language design, what is the correct result of suc...
https://en.wikipedia.org/wiki/Type_inhabitation The wiki article above says, To be sound, such a system must have uninhabited types. What is the definition an uninhabitated type? Do all programming languages have uninhabited types? What would be an example in Haskell? Or C? Or Java? Or Python?
As far as I know, finite languages have a finite number of strings or words, while context-free languages are generated by context-free grammars. I don't know which aspect should I know that they are correlated with. All I know is that finite languages are regular, and regular languages are context-free. How should I k...
The types of problems I am trying to solve are as follows: Given a set of co-ordinates such as: (1,2), (3,3), (6,2), (7,1), a value of k such as k=3 and an initial set of centroids such as c1=(2,2) and c2=(5,4), perform the k-means/median algorithm. Now, with samples that small, I can easily work it out on paper. Howev...
We have the following operation $\text{IF} \ x_i =0 \ \text{THEN} \ P \ \text{END}$. I want to simulate this using a $\text{LOOP}$ program. Here is what I have: $$\text{IF} \ x_i = 0 \ \text{THEN} \ P \ \text{END} \ ≙ \begin{cases} x_j := 1; \\ \text{LOOP} \ x_i \ \text{DO} \ x_j := 0 \ \text{END}; \\ ...
In this site here they have just said how to minimize a function using VEM. But no intuitive logic behind the same has been stated, making it too mechanical. And I am very bad at memorizing things, so an intuitive logic behind the same would help me a lot to solve problems using this problems independently.
I would like a review for my algorithm for the following question: A flow network is a “balanced network” if for every $v∈V- {s,t}$ it holds that $c_in (v)=c_out (v).$ Let G be a balanced network in which in-degree(s)=out-degree(t)=0 Find max-flow for G. My Algorithm so far: We will define the following capacity-funct...
From wikipedia: In type theory, a theory within mathematical logic, the bottom type is the type that has no values. It is also called the zero or empty type, and is sometimes denoted with the up tack (⊥) symbol. The "bottomest" types I can think of in js are undefined and null, both unity types. Notice how in TypeScr...
I have a simple graph $G = (V,E)$ and each vertex has a range $[a,b]$. Every two vertices are connected only if $[a_1, b_1]$ and $[a_2, b_2]$ have a common subrange. Each range of vertex is rV1 = [0,5] rV2 = [1,3] rV3 = [2,10] rV4 = [4,9] rV5 = [6,7] rV6 = [8,12] rV7 = [11,13] Graph Created based on above ranges. Based...
I am quite new to python. I want to create a Python program to output the smallest palindromic number above a given input. But this input can be up to 20 digits. I tried finding all the palindromic numbers and adding them to a list. But it seems like for 20 digit numbers, it is a very long process. What python code wou...
I want to make a facial recognition project but my coding ability is very limited so I am going to be relying on other peoples code but if i use their code even if i change the variables and make different functions to add their code under would that still be considered plagerism ?
I ran into an interview two days ago and came across one strange definition of safe edge. We are given an undirected weighted Graph $G = (V,E)$ with all distinct edge weights. Assume that the graph is connected. Safe Edge Definition: if an edge $e \in E$ is not contained in any cycle, we called it a safe edge Followi...
When we plan the motion of a robot we may apply the trapezoidal decomposition of free space. While applying the trapezoidal decomposition we add nodes to both the centers of trapezoids and vertical walls. When a robot wants to traverse between obstacles it avoids the obstacles by following the nodes added. The nodes ...
theoretically, the state is between the two kleene-stars of the work-alphabet gamma* q gamma* where q is the current state and each gamma* is the content of one of both stacks. But where is "the middle" with the state? Regarding the one tape of the classical Turing Machine it is obvious. Yours, von Spotz
Maybe the title is bad format but, I want to ask if is possible proof the Segment Tree complexity with the recursion tree. In other words I'm making a simple report on segment tree and I want to try to prove with a simple image that the complexity time on each query is O(log N), so to do that I make a simple assertion ...