instruction
stringlengths
35
11.4k
I was reading this link. Here I noticed that, in table titles "Float Values (b = bias)", in exponent column, entry for denormalized reals is $00..00$, but in value column, the entry is $-b+1$. Why is there $+1$? If we consider bias of $127$ for single precision format, shouldnt it be $0-127$ only? If its $-126$, then s...
A seek is the task of positioning the read/write head of the disk to the required data block, and irrespective of the size of the data block, all contiguous data can be accessed using a single seek. Seek complexity of an algorithm is defined as the number of times the algorithm leaves one data locality for another, (or...
I was listening CS231n (2017) lectures and noted that there is a lot of attention to Numerical Gradient Computation (NGC). It starts @5:53 in this video and appears a few times later. Also, looking at the batch normalization materials (example), I found a lot of attention drawn to exactly the same topic (well, probably...
I am studying for an algorithms exam and ran into this example problem. A circular disk with radius $2r$ can be covered by $7$ circular disks with radius $r$; in the following you can use this statement without proof. Suppose that we are given a set $S$ of $n$ points in the plane, and we want to cover all points ...
I am reading about divide and conquer algorithm at following link on page on 57 in this link. The document analyzes the running time of the algorithm. At the very top level, when $k = 0$, this works out to $O(n)$. At the bottom, when $k = \log_2 n$, it is $O(3^{\log_2 n})$, which, the author claims, can be rewritten as...
Given $N$ circles and $Q$ points. What is the optimal solution for checking "if point is covered by any circle" for every point? The trivial solution would be $O(QN)$.
$L_1= \{ \langle M \rangle \mid L(M) \text{ is strings of length between } 1 \text{ and } 5 \}$. $L_2 = \{ \langle M \rangle \mid L(M) \text{ is strings of length at most } 5\}$. I am able to figure out that both languages are undecidable as we can have $TM_{yes}$ and $TM_{no}$ and as per Rice's theorem it's undecida...
I read about Virtual Memory in various CS references, however I'm still not sure whether CPU caches such as TLB, L1 and L2 are integrated within MMU. Also I don't know if the hit/miss operations are managed by hardware (i.e MMU) or by software (i.e OS). Does anyone have any idea?
I'm looking at some lambda calculus at the moment and came across this question: 0:R 1:R plus: R->R->R (lambda f:T . lambda g:U . (f 0) (g 0)) (plus 1) (plus (plus 1 1)) Is it well typed given appropriate types for T and U? I'm new to lambda calc but I gather that we substitute (plus 1) for f and (plus (plus 1 1)) for ...
I was referring Booth's algorithm for 2's complement multiplication from William Stallings book. It was explained as follows (please ignore two starting words "As before", it still makes complete sense): The author then gives following example for $7\times 3$, which I am able to understand: Next author gives exa...
My question is as follows: Assuming that $P \neq NP$, show that there exist sets $A$ and $B$ in $NP$ such that neither $A \leq _T^p B$ nor $B \leq _T^p A$, where $A \leq _T^p B$ if there exists a polytime deterministic oracle machine that computes $A$ given access to $B$. That is, $A \leq _T ^p B$ if $A = M^B$ for some...
Are there any examples of context-free grammars for which we simply do not know whether they are ambiguous? By examples I mean an actual specification for the grammar, not some kind of non-constructive existence proof with a counting argument or whatnot. To make things more clear, I should be able to write a parser for...
What algorithm should be used here to solve this problem efficiently? One file stores 5 year log of user IDs & their website visit dates in random order. There were around 1,000,000 users on the website and 1/4 of them were active. Active users visited the website 100 times a day on average. You need to create a new fi...
According to Karpathy's blog "The Unreasonable Effectiveness of Recurrent Neural Networks", recurrent neural networks can map variable-length sequences to variable-length sequences, as shown by the one-to-many, many-to-one, and many-to-many diagrams. How do RNN's do this mapping of possibly different-length sequences? ...
This is referring to not the length of the path, but the sum of the weights of the path traversed. I am getting confused by the variety of algorithms out there. Suppose that for a graph represented by a dictionary of tuple keys and integer values, my simple idea is to check each pair of nodes to see which nodes connect...
I want to show that unrestricted grammar is closed under intersection and I don't want to use Turing machine or etc. So I think that we have two grammar $G_1$ and $G_2$ that are restricted for example simple grammars $$ S \rightarrow XY \\ X \rightarrow aXb | ab \\ Y \rightarrow Ya | a$$ and also $G_2$ is $$ S \righta...
I am having difficulty in reducing non halting problem to the given problem to prove that language is non R.E For eg Completeness problem of TM . In the above problem, we accept $\Sigma^*$ if H does not halt on w . For doing that, we give an input $x$ and simulate H on w for $|x|$ steps. I don't understand how can we ...
I am studying network formation models and I have seen the separation of those models into two groups (wikipedia): Agent-based models: Aka game-theory based models. This distinction makes sense to me. But it mentions a "fixed number of players". Are there no game theoretic models with a dynamic number of players? Dy...
For a typical finite element algorithms, what kind of order of growth in solution time (i.e solve stiffness matrix & post-processing) are we expected to see with an increase in number of elements? Literature I have seen show exponential and power-law like behavior when comparing solve time to number of elements even wh...
how to represent an observation matrix if we do not have a defined observation alphabet? I'm working on extraction of data in a text.
We have a graph with $n$ nodes and maximal degree $k$. On this graph we run a coloring algorithm that finds a maximum independent set. The algorithm colors every node green with probability $\frac{1}{k}$ and colors the node red otherwise. This is done independently for every node. Return the independent set of nodes $x...
when i was studying compilers i came across this in Wikipedia every DCFL has a corresponding unambiguous grammar and hence can be parsed by an LR(1) parser which is the most powerful parser then what is the significance of LR(k) parsers are they more powerful than LR(1) when every DCFL can be parsed by LR(1) why do we ...
Could I transform a bounded-knapsack problem into a 0/1 knapsack problem using the following way-: Example: Lets says I have 3 types of items $n=3$ $p_j=\{10,15,11\}$ $w_j=\{1,3,5\}$ $b_j=\{6,4,2\}$ $c = 10$ Here $n$ denotes the number of types of items, $p_j$ denotes the profit gained by including 1 item of a that par...
I have a table which stores all serial numbers of devices in my system: |------------------------|--------------------------| | # | Serial number (4 bytes) | |------------------------|--------------------------| | 1 | 0x???????? | |------------------------|------...
given 2 lagnauges A,B which are npc. is there a reduction function from A to B $A \leq_PB$ ? my idea was to say that since they are decideable, we can do this: $$ f(x) = \begin{cases} y \in B & \text{ } if x \in A \\y \notin B & \text{if }x \notin A.\end{cases} $$ is this is correct? or its not something that can be t...
I read in some text book ( either ullman or peter linz) that a turing machine must have at least two states. I don't understand why? For example if we want to build a Turing Machine for the empty language then we can start in state $q_o$ (accept state). We will define only one transition for epsilon on which the input ...
CNFSAT is the language of all strings that are encoding of satisfiable boolean formula in conjunctive normal form while CNFFAL is the language of all strings that are encoding of falsifiable boolean formula in conjunctive normal form. Any boolean formula is satisfiable if and only if exists an truth assignment of True ...
I am trying to optimize a coefficients of filter by minimizing sum-squared error. I want to use a genetic algorithm (GA) optimization wherein the coefficients of filter form the GA's chromosome (a vector). How can I construct the objective function, given that I want it to use least-squares minimization?
Till date I have read that a Turing machine can do whatever a computer can. Wikipedia Turing machine mentions that since a real machine can have only a finite number of configurations it is equivalent to linear bounded automata. Is this true?
Let C be a cycle in a simple connected weighted undirected graph. Let "e" be an edge of maximum weight on C Which of the following is TRUE? (A) No minimum weight spanning tree contains e. (B) There exists a minimum-weight spanning tree not containing e. (C) no shortest path, between any two vertices, can contain e....
The above answer taken from the book https://www.amazon.com/Operating-Systems-Sibsankar-Haldar/dp/8131730220 says starvation freedom may not imply progress as processes can be deadlocked. I think that starvation freedom implies deadlock freedom so there is no chance of deadlock and progress is also satisfied. Is the a...
I want to optimization the coefficient of FIR filter using genetic algorithm method. The main data structures in the Genetic Algorithm are: chromosomes (vector) objective function values fitness values If the objective function is : and in the passband in the stopband How to determine the objective function ?
It is said that this problem is NP-complete but I couldn't find the proof. Is there any paper on this problem or not?
As a follow-up from my old question here, I'm wondering more about the equivalence proof. Intuitively, NP has been described as the class of all problems which a solution certificate can be verified in polynomial time. Let's say we have a problem $K$ in NP and we have a certificate $c_e$ obtained externally that proves...
In python3.6, I tried In [60]: a = '\a' In [61]: b = '\b' In [62]: c = '\c' In [63]: l =[a, b, c] If test l In [64]: l #it output following list instead of ['a','\b','\c'] Out[64]: ['\x07', '\x08', '\\c'] encapsulate them directly in a list. In [70]: ['\a','\b','\c'] #it output following list instead of ['a','\b','...
I need some help with the following question: Recall the subset sum problem, which is known to be NP-complete: "Given a finite set of natural numbers and a number $n$, decide whether a subset of the given set exists such that the numbers in that subset sum up to $n$." We consider the great subset sum problem: "Given a...
Say there is a file that is sequentially organized over 2.5 tracks on a disc. I'm assuming there would be a non-zero value for seek time and latency when accessing the first track, but what about the remaining 1.5 tracks? I know it wouldn't actually be zero but I'm talking about a negligible value. When the head moves ...
Title: Best-worst multi-criteria decision-making method Author:Jafar Rezaei, Pub: Omega 53 (2015) 49-57 BWMCD From this example How are optimal weights (W1*, W2* etc) computed on Page:22 ? what are the values of WB, Wj, aBj, WW, ajW for W1 and W2 such that optimal weight of W1* = [0.1579, 0.2469] and W2* = [0.4286, 49...
Given the equation : x & y = x, where x, y are positive integers. Note: Here '&' stands for Bitwise operator AND between two numbers. I am provided with the value of x. Can I find possible values of y satisfying the given equation ? Thanks for help!
I've this exercise of which I'm not very sure about my solution. Exercise: Define the transition table about a Turing Machine that accepts words on the {a, b} alphabet where each a is followed by only two b. My proposed solution is: (f stands for transition function) f(q0, a) = (a, q1, R) f(q0, b) = HALT f(q1, a)...
For an Hamming code of $n$ bit there are $k$ bit reserved for the data and $p$ bit for the parity where $p$ is the minimum integer for which the following inequation is satisfied: $$2^p \geqslant p + k + 1$$ This because at least $p$ bit are required to code $n$ error on a single bit $+ 1$ for the "no error" word. For...
Ok, so I got this for homework and been struggling for a while now. The full assignment requires this: While N = number of elements in given array and n = number of different elements, init(S,A[1...N]) - accept an array A as input and initialize S data structure in O(Nlogn) time insert(S,x) - insert the key x to S in ...
According to this source and Tanenbaum's Modern Operating Systems a possible implementation of RAID 2 consists of 4 data disks and 3 disks which contain parity bits. Why don't we need 4 disks that stores parity bits, why just 3? Also in RAID 3 we need just one disk for storing parity bytes for 4 data disks. What would ...
In the following, I consider rooted, unlabelled, ordered binary trees, where each node has exactly $0$ or $2$ children (I will simply call them binary trees). A binary tree $t'$ is a subtree of a binary tree $t$ if there exists a node $v$ in $t$ such that the tree rooted at this node $v$ equals $t'$. For a binary tree ...
I made a home 45 min video of myself giving a presentation on a physics topic using my iphone 6. The format is quicktime .MOV - about 2.8 GB. I converted it to .mp4,down to 650MB,using a software avidemux. After that I used a linux utility ffmpeg and used a 'drawtext' feature to add relevant text/equations at relevant...
It is well known that 2x2 matrices can be multiplied using just 7 (instead of the obvious 8) multiplications in the ground field (Strassen-Winograd, etc.). It is also well known that complex numbers can be multiplied using just 3 real multiplications, using what is basically Karatsuba polynomial multiplication. You can...
I was reading in Wikipedia about it and one of the main things that were pointed out was that it is only an optional mechanism. This bugs me more than it should as I cannot find any information that I can understand about it. Can anyone explain to me like I am a five-year-old why are they optional?
As I know, SSL/HTTPS is two stage, first stage is public key encryption/decryption which transfers key of the second stage which is symmetric. It is true we don't have key, but we can have some of plain data and guess key so (at least some of messages), do you agree it is possible so? Thanks!
According to Cormen book,number of probe sequences possible in linear probing if hash function is given as $h(k,i) =( h' (k) + i)$ $\text % m $ is m if h'(k) = k modulo 5 and m = 10, then how can we have 10 distinct probe sequences? Initial probe is decided by h'(k), so number of probe sequences should be limited by ...
I've been reading up on the automatic text summarization approach TextRank, particularly for generating summaries of a text using sentence extraction as opposed to keyword or phrase extraction. In the published paper, an example body of text and the resulting ranked graph of all sentences/vertices and their edges is gi...
A real-life computer can only store programs and inputs up to a certain length, which means that its halting problem can be solved with a lookup table. The most obvious way to represent this table grows exponentially with the number of bits in the computer's state description, and so wouldn't fit inside the memory of t...
I am quite new to image processing. I have experimented with opencv and tried to measure the lenght and width of an object from a picture using a reference object where I know the dimensions. See this Link https://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/ Thats working quite we...
I have read that cyclomatic complexity is widely used, but critique on it exists claimed that it is based on poor theoretical foundations and an inadequate model of software development. I have read here page 10, second para
I know ¬H is not semidecidable so I was thinking of creating a language that combines both H and ¬H. Therefore L would be undecidable for ¬H and ¬L would be undecidable for H. Is this a proper approach for this question or am I completely off mark? I also have few other questions, give an example of a language where: 1...
I read The Complexity of Theorem-Proving Procedures by Stephen A. Cook (1971). Cook explains how to create a boolean formula $\Phi$ from $(M,w)$, where $M$ is a non-deterministic Turing machine that always halts in a polynomial number of steps and $w$ is a string in $\Sigma^*$ so that $\Phi$ is satisfiable if and only ...
Suppose we are given A, an array of size n, comprised of an increasing sequence of numbers followed immediately by a decreasing one. What is worst case time complexity of optimal algorithm to determine if a given number x is in the array? The explanation given on the this site is confusing to me. How we can apply binar...
I have an assignment to do which involves reducing an Untyped λ-Calculus expression to Normal Form. I am struggling to come to terms with Lambda Calculus though. For example, one small part of the expression is: ((λ n f x . n f (f x)) (λ f x . x)) Does this mean that we substitute (λ f x . x) in for every n, f and x?...
Is there an existing algorithm that can solve the following problem? Problem Given an list N comprised of integers of various values, shard the list into k buckets such that: The sum of the integers in each bucket are roughly evenly divided (as much as possible Only consecutive integers are placed in the same bucket ...
I recently saw a problem from Numberphile here, where the goal is to arrange the numbers $1,\ldots,n$ so that the sum of adjacent numbers is a perfect square. This question from Mathematics Stack Exchange has a good analysis of the generalization of the problem for arbitrary powers, but I have been unable to find an an...
We have some best sorting methods like quick sort, merge sort etc., then why we need other sorting methods which perform poor?
We know that asymptotically $O(1)$< $O(\log_2 n)$ < $O(n)$, but $O(\log_2 n)$ is asymptotically close to $O(n)$ or $O(1)$?
Here's the exact problem I'm having with Grover's search algorithm.. Given a function f:{0,...,N-1} -> {0,1}, Grover's problem is to find x such that f(x)=1, provided that there exists such x. The phase inversion step: Invert the phase of the "key value". So my question is, when we can already distinguish the key from...
I'm working on a website which gets a list of objects like this: Object { model: "modelhandler.comment", pk: 5, fields: Object } where the field objects contains this: Object { user: "TestUser",id: 6, video: 7, description: "test new video comment lol", reply_to: 5, uploaded: "2018-01-12T09:14:24.281Z", updated: "2018...
When we wanted to construct a PDA for $0^n1^n$ the idea was to put all the zeroes (which is a part of the input string) to the stack associated with the PDA, and then pop each of them when we get a $1$ from the latter part of the input. But when we try to prove that, we can create a PDA for a given CFG we put nontermin...
This comment by @DerekElkins suggests a general method of constructing decision problems for problems with bit-strings as output, of which a slightly formalised version is the following: Given a problem $X$, where we expect output for input $x$ to be $X(x)$, construct the following decision problem $B_X$: Given $(n,x)...
I wrote the worst algorithm in the world. Doesn't matter what it does. I have just a question about folding formula for it's time complexity into some shorter form which would be easier to compute. So I concluded that the equation for the number of operations is as follows: $$n + n(n-1) + n(n-1)(n-2) + n(n-1)(n-2)(n-3)...
In Team Orienteering Problem (TOP) we have a graph $G=(V,E)$ and $K$ participants, We are supposed to find $K$ paths with total edge cost less than a threshold while maximising total vertex rewards. The constraint on reward collecting is once a reward has been collected by some participant the it can not be collected a...
I am reading about Base & Bounds memory protection mechanism, and I noticed the use of the term 'relocation' in the context of address space, but failed to understand the meaning associated with it. Below are some examples: U.C Berkeley L02/CS162: relocating loader Wisconsin S15/CS537 Each process appears to have ...
If we have different objects, [A1, A2, A3, B1, B2, B3, B4, B5] Some calculations will be performed to find compatible objects. For example, lets assume following 3 sets were formed and every set contains compatible objects: 1. {A1, B2} 2. {A3, B2} 3. {A1, A3, B4, B5} Now we need to perform filtering. One node can...
$L = \{ \langle M \rangle \mid \epsilon \in L(M) \}$, where $M$ is any Turing machine. Why is the above problem undecidable? Can't we just check whether the initial state is a final state and say the TM accepts $\epsilon$ if the initial state is the final state else it doesn't? We can also just check if the TM goes to ...
I'm studying the theory behind compiler design, and was assigned with building an Interference graph for a certain code 3-address code. We were taught to first divide the code into blocks (according to GOTOs), and draw lines that represent a variables lifeline. I am not sure on a = a op c (that is, same variable is b...
After reading about Base & Bounds memory protection mechanism from Stanford CS140 lecture notes, I understood from the explanation below that there is an integrated circuit performing B&B checks somewhere in the CPU (correct me if I'm wrong): On each memory reference, virtual address is compared to the bound register,...
While I was reading about Base & Bounds memory protection mechanism, I noticed the use of the abbreviation RTU as indicated in the slide below: However I didn't know what it means. So after searching for 'RTU', I found only this article on Wikipedia; But I'm not sure whether it matches the term. Does anyone have any i...
I am studying tree traversals and I've got to know that we can uniquely determine the binary tree if their: Case 1. Preorder & inorder traversals are given or Case 2. postorder & inorder traversals are given We can not determine the tree if only one of the traversals are given because there will be finitely many trees ...
Lately I've been toying with an automatic solver for the Android/iPhone game Flow. In this game, you start with several pairs of squares on a grid, and you have to connect each pair, without crossing the paths, and by using every square on the grid. Here's a simple 7x7 example (the hardest boards in the game are 11x13)...
I'm in the middle of building a homemade processor from logic chips, and I've been trying to figure out how I can have RAM (for main memory) and ROM (for small booting stuff) on the bus at the same time. I came up with memory mapped I/O, but how do i make my 8-bit processor have a 20-bit address bus? (enough lines for ...
First I'll introduce the problem with just two substrings. Say you are asked to construct a NFA which accepts the input string if it has both "bb" and "aba" as substrings. The solution we came up with in class was that we'll make a NFA with multiple start states (a start state with $\epsilon$-transitions to each of ou...
P.S. I have added the tag 'history', if there is any historical connotation. Also, I found this question What is running time of an algorithm? but I am not satisfied with answers.
I have a set of letters, and a list of words, and I'd like to find all the possible "sentences" that can be built using the words from the list, while using up all the letters in the process. (A word can be used more than once.) The maximum amount of words in a sentence is also given. For example, my letters are {"a","...
From wikipedia In computational complexity theory, a numeric algorithm runs in pseudo-polynomial time if its running time is a polynomial in the length of the input (the number of bits required to represent it) and the numeric value of the input (the largest integer present in the input). In general, the numeric valu...
Generating sequence containing every possible bit sequence of lengths from $1$ to $n$ is trivial - just generate every possible sequence of length $n$. But how do you generate the shortest sequence containing every possible bit subsequence of lengths from $1$ to $n$ (using the fact that subsequences may partially overl...
I stumbled upon this which looks like a promising way of implementing an orientation test. I'm not interested in the described adaptive approach, I'm fine with using the naive determinant approach by checking if it evaluates to greater/less/equal 0. As I understand it, the only difference is that the more sophisticate...
I've just designed an algorithm to prune a tree related to a particular fluid dynamics problem, and I need to determine its computational complexity; however, since I'm just a newcomer (from mechanical engineering) to the computational complexity theory, I'm not sure about the following reasoning: The while loop itera...
I'm reading about genetic algorithms, and I'm not sure I understand the point of selection step.Let's say we have a population of size $N$.How many chromosomes should we select using any selection method and what's the point if the population size is fixed ? From what I understood till now we select a number of chromo...
Suppose $G$ is a bipartite graph which has a perfect matching. I want to find the fewest number of edges to delete from $G$ so that a perfect matching no longer exists. What is the complexity of this problem? I'm aware that perfect matching has a formulation as a max-flow. One approach is, therefore, to find a min-cut ...
I recently started learning about asymptotic notations. While I was doing practice questions (not HW) I found various question that stumped me totally. So I just want some pointers on how to go by solving these type of questions. So here is a basic question. Given the following, If $f(n) = \Omega(h(n))$ and $g(n) = O...
Cook-Levin reduction is both deterministic polynomial time and parsimonious and that's mean that from every non deterministic Turing machine $M$ and string $w$ it is possible in polynomial time deterministically to create the boolean formula $\alpha_{M,w}$ so that every satisfying assignment of $\alpha_{M,w}$ is accept...
All the example of DFS I've seen so far are for undirected graph. In a directed graph the basic DFS algorithm won't work because some vertex will be unreachable. The algorithm I'm talking about : https://en.wikipedia.org/wiki/Depth-first_search 1 procedure DFS-iterative(G,v): 2 let S be a stack 3 S.push(v) 4...
I've read from this How data is physically stored in hard drives, that the North/South orientation of the magnetic medium represents data as 0 or 1 physically in the hard drive. Data is stored in binary, which means that it can be stored as either 0 or 1 in the hard drive. But what determines if that particular block o...
I am trying to figure out an efficient way to produce all the numbers in a given range for which, their bitwise AND with a positive integer (say x) gives the same number; that means k & x = k. Is there a better way to do it so that I do not need to go through all the numbers from 0 to n and check for it?
I need to find the order of the minimum k = k(n) such that the probability of having at least 1 k-clique in a random graph $G(n, \frac{1}{2}$) is $\mathcal{O}(\frac{1}{n})$. $X_k$ is the random variable which count the number of k-cliques in a random graph. I already know $E[X_k] = \binom{n}{k}(\frac{1}{2})^{\binom{k}{...
Assuming, I have an arbitrary CNF Formula in which each variable has at most two occurences, how can I proof/show that this can be solved in polynomial time? My first thoughts so far: because each variable has at most two occurences, the formula contains at most 2*n literals, where n is the amount of different variable...
I have come across the following question in an exam: Can inherited attributes be evaluated in bottom-up parsing? My approach went like this: Inherited attributes can never be evaluated in bottom-up parsing because the parent node is not constructed during parse yet when we visit the child node. In order to evaluate...
I was asked to define the language which is produced by the following grammar: $G = (V, \Sigma, S, P)$ $V = \{S, A, B\}$ $\Sigma = \{a, b, c\}$ \begin{equation} P= \begin{cases} S \rightarrow cA | bB\\ A \rightarrow c \\ B \rightarrow aB|b \end{cases} \end{equation} Obviously, you can pr...
if pipelining is devided to polyfunctional pipelining and monofunctional pipelining(im sorry im not a native speaker the name may be incorect) and the polyfunctional pipelining is futher devided to STATIC and DYNAMIC, then what is the differance between static and dynamic and what is the overall differance between poly...
For a grammar $G$, why is the problem of whether $L(G)=\emptyset$ is undecidable? I'm confused as, for recursive languages there exists a Turing machine which will halt every time and give an answer(accepted or rejected) for each and every string input. So we can decide whether it accepts strings or not.
From "Introduction to Algorithms" by Cormen, Leiserson, Rivest, Stein, Third Edition, page 453: Let us analyze a sequence of $n$ Push, Pop, Multipop operations on an initially empty stack. The worst-case cost of a Multipop operation in the sequence is $O\left(n\right)$, since the stack size is at most $n$. The worst-c...
From Database System Concepts, by Silberschatz, Korth and Sudarshan : A domain is atomic if elements of the domain are considered to be indivisible units. We say that a relation schema R is in first normal form (1NF) if the domains of all attributes of R are atomic. A functional dependency A →B is called a parti...
From Database System Concepts, by Silberschatz, Korth and Sudarshan : A domain is atomic if elements of the domain are considered to be indivisible units. We say that a relation schema R is in first normal form (1NF) if the domains of all attributes of R are atomic. From https://stackoverflow.com/a/724032/15645...
I have an uncommon use case I have a vector, which contains a fixed number of taxi's real-time fees (the red/green number that keeps bumping up when you sit in the back). This vector is continuously updated by message sent back from taxis. I need to find the top 10 taxis every time when there is an update. if I only ne...