This is a simple question from algorithms theory. The difference between them is that in one case you count number of nodes and in other number of edges on the shortest path between root and concrete node. Which is which?
...
Is there a resource that i can find different variations of searching, sorting and graph algorithm questions ?
I have studied CLRS and Algorithm Design by Kleinberg. and solved some set of questions.
I have also, checked SO for algorithms questions.
Curious, if there is a resource you would highly recommend.
EDIT: There is also this...
I have the following problem: I am given a tree with N apples, for each apple I am given it's weight and height. I can pick apples up to a given height H, each time I pick an apple the height of every apple is increased with U. I have to find out the maximum weight of apples I can pick.
1 ≤ N ≤ 100000
0 < {H, U, apples' weight and ...
We have a proprietry system where we can configure fields on indiviual forms.
However these fields have a global tab order (we cannot specify for a specific form).
We have a bunch of forms (35 in total) which share a lot of different fields.
Each form has a specific tab/edit order that needs to be configured.
Example:
Form 1 has fie...
I have a text file which contains some info on extents about all the files in the file system, like below
C:\Program Files\abcd.txt
12345 100
23456 200
C:\Program Files\bcde.txt
56789 50
26746 300
...
Now i have another binary which tries to find out about extents for all the files.
Now currently i am using linear search to find extent ...
I recently came across a question somewhere:
Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of ...
Single Source shortest Path
Dijkstra's - directed and undirected - works only for positive edge weights - cycles ??
Bellman Ford - directed - no cycles should exist
All source shortest path
Floyd Warshall - no info
Minimum Spanning Tree
( no info about edge weights or nature of graph or cycles)
Kruskal's
Prim's - undirected
...
Hey all;
i am currently doing a project that requires the use of AVL trees ,
the insert function i wrote for the avl does not seem to be working , it works for 3 or 4 nodes at maximum ;
i would really appreciate your help
The attempt is below
Tree insert(Tree t,char name[80],int num)
{
if(t==NULL)
{
t = (Tree)malloc(sizeof(stru...
Does anyone have any suggestions about where I can find a C# implementation for suffix arrays? I'd prefer not to reinvent the wheel...
...
I want to create a city filled with virtual creatures.
Say like Sim City, where each creature walks around, doing it's own tasks.
I'd prefer the city to not 'explode' or do weird things -- like the population dies off, or the population leaves, or any other unexpected crap.
Is there a set of basic rules I can encode each agent with so...
Two questions:
Question 1: Under what circumstances would O(f(n)) = O(k·f(n)) be the most appropriate form of time-complexity analysis?
Question 2: Working from mathematical definition of O notation, how to show that O(f(n)) = O(k·f(n)), for positive constant k?
My view: For the first one I think it is average case and worst case form...
I want to know , What is the advantage of Lucene searching and indexing ?
Is searching with Lucene as fast as other searching algorithm like Quick Search?
What about indexing ?
I want to know more about advantage of Lucene rather that others .
thanks .
...
I have an application which I'd like to carry out certain actions atomically.
However, these actions are occurring on remote storage, and connections may drop, actions may fail, etc.
There's plenty of literature on how to enforce ACID properties - write-ahead logging, ARIES, etc. - but are there any generic implementations of these avai...
My co-workers took me back in time to my University days with a discussion of sorting algorithms this morning. We reminisced about our favorites like StupidSort, and one of us was sure we had seen a sort algorithm that was O(n!). That got me started looking around for the "worst" sorting algorithms I could find.
We postulated that a c...
Hello again guys,
question 1: why is average case analysis more difficult to carry out than the worst case analysis. got to think of alteast 4 points, thought of 1, am i right?
answer: Algorithm exist for which no such analysis has been possible
question 2: what is elementary operation in terms of time measure? and why is time-demand...
Suppose I want to change the orange node in the following tree.
So, the only other change I'll need to make is in the left pointer of the green node.
The blue node will remain the same.
Am I wrong somewhere? Because according to this article (that explains zippers), even the blue node needs to be changed.
Similarly, in this picture...
I'm trying to design an implementation of Vector Quantization as a c++ template class that can handle different types and dimensions of vectors (e.g. 16 dimension vectors of bytes, or 4d vectors of doubles, etc).
I've been reading up on the algorithms, and I understand most of it:
here and here
I want to implement the Linde-Buzo-Gray ...
Suppose i have a Family hierarchy or an organization hierarchy.
I want to create a tree supporting this. i.e in a tree, node can have multiple child nodes. each child node can be a leaf or a parent of another tree.
which tree data structure is suited for this?
...
I have a nested list something like this:
PLACES = (
('CA', 'Canada', (
('AB', 'Alberta'),
('BC', 'British Columbia' (
('van', 'Vancouver'),
),
...
)),
('US', 'United States', (
('AL', 'Alabama'),
('AK', 'Alaska'),
...
I need to retrieve some data out of i...
I have a buckets of numbers e.g. - 1 to 4, 5 to 15, 16 to 21, 22 to 34,....
I have roughly 600,000 such buckets. The range of numbers that fall in each of the bucket varies. I need to store these buckets in a suitable data structure so that the lookups for a number is as fast as possible.
So my question is what is the suitable data stru...