Problem Detail: Given a $ntimes m$ matrix $A$ of integers, find a sub-matrix whose sum is maximal. If there is one row only or one column only, then this is equivalent to finding a maximum sub-array. The 1D version can be Read More …
Blog
How to use adversary arguments for selection and insertion sort?
Problem Detail: I was asked to find the adversary arguments necessary for finding the lower bounds for selection and insertion sort. I could not find a reference to it anywhere. I have some doubts regarding this. I understand that adversary arguments Read More …
Valid-invalid bit in a process page table
Problem Detail: Valid-invalid bit is used to indicate whether a page in a process’s page table is valid or not. Why is it needed? Does that mean that each page table has a certain minimum size, i.e. it can accommodate minimum Read More …
MST: Prim’s algorithm complexity, why not $O(EV lg V)$?
Problem Detail: According to CLRS, the Prim’s algorithms is implemented as below — $mathtt{text{MST-PRIM}}(G,w,r)$ for each $u in V[G]$ do $mathtt{text{key}}[u] leftarrow infty$ $pi[u] leftarrow mathtt{text{NIL}}$ $mathtt{text{key}}[r] leftarrow 0$ $Q leftarrow V[G]$ while $Q ne emptyset$ do // … $O(V)$ $u$ Read More …
Does our PC work as Turing Machine?
Problem Detail: Does our PC work as Turing Machine? The model of a Turing Machine consists of infinite memory tape, which means infinite states. But suppose if our PC has 128 MB memory and 30GB disk it would have 256^30128000000 states Read More …
How to prove correctness of a shuffle algorithm?
Problem Detail: I have two ways of producing a list of items in a random order and would like to determine if they are equally fair (unbiased). The first method I use is to construct the entire list of elements and Read More …
How to find the maximum independent set of a directed graph?
Problem Detail: I’m trying to solve this problem. Problem: Given $n$ positive integers, your task is to select a maximum number of integers so that there are no two numbers $a, b$ in which $a$ is divisible by $b$. I have Read More …
What graph data structure works fastest with Dijkstra’s algorithm?
Problem Detail: What data structure should I store my graph in to get the best performance from the Dijkstra algorithm? Object-pointer? Adjacency list? Something else? I want the lowest O(). Any other tips are appreciated too! Asked By : Barry Fruitman Answered Read More …
How to prove that a constrained version of 3SAT in which no literal can occur more than once, is solvable in polynomial time?
Problem Detail: I’m trying to work out an assignment (taken from the book Algorithms – by S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani, Chap 8, problem 8.6a), and I’m paraphrasing what it states: Given that 3SAT remains NP-complete even when restricted Read More …
Context-free grammar for ${ a^n b^m a^{n+m} }$
Problem Detail: I’ve got a problem with this task. I should declare a context-free grammar for this language: $qquad displaystyle L := {, a^nb^ma^{n+m} : n,m in mathbb{N},}$ My idea is: We need a start symbol, for example $S$. I know Read More …