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 …
Category: Uncategorized
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 …
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 …
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 …
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 …
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 …
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 …
Time Complexity for Creating a Graph from a File
Problem Detail: Assume that I have a file that consists of pairs of numbers separated by a space. These numbers are the labels for vertices in my graph. For example: 0 5 0 7 2 3 4 5 1 5 . Read More …
Can input to a Turing machine be of infinite length?
Problem Detail: Considering only the alphabet $Sigma = {0,1}$, the strings which can be given as input to the Turing machines are from the set $Sigma^{*}$. But does it make sense for the input to be an infinite binary string ? Read More …
Prove that regular languages are closed under the cycle operator
Problem Detail: I’ve got in a few days an exam and have problems to solve this task. Let $L$ be a regular language over the alphabet $Sigma$. We have the operation $operatorname{cycle}(L) = { xy mid x,yin Sigma^* text{ and } Read More …