[Solved] SQL Database Algorithm

Even though this question is Way too broad, and actually not asking anything, i’ll give it a few minutes of attention. 1) You backup the current state and work on a Sandbox! 2) if your only need is few reports, i guess you can generate them query the different databases independently and maybe post processing … Read more

[Solved] How to solve this mathematical equation in php [closed]

Just group the D’s first and dont hardcode the indices, use $i $S = array(); $D = array(); $M = array(“1″=>30,”2″=>31,”3″=>30); $Y = array(“1″=>360,”2″=>360,”3″=>360); $O = 30000; $P = 0.3; $N = 10509.74; for($i = 1, $size = count($M); $i <= $size; $i++){ $final_D = 0; // group the D’s first (O-D1), (O-D1-D2), … and … Read more

[Solved] A program which is difficult

Essentially, your question is this: given a graph with nodes represented as indices and edges as index pairs, and given an index i that represents a node, find all nodes which are connected to the given node. UnionFind algorithm to find connected components over nodes with indices: Initialize an array father of size number of … Read more

[Solved] unable out figure out error in below program [closed]

This is a case of undefined behavior: if(!visited[j]) is undefined. visited is not initialized because the call memset(visited, sizeof(visited), false); is wrong. You are reading uninitialized variables. The declaration of memset is void *memset( void *dest, int ch, size_t count ); You are writting 0 times the value 10000 into visited. On your machine this … Read more

[Solved] Interval range insert with split into unique ranges

in the actual code there is a differentiation between old interval ranges and new ranges after applying certain operation those ranges would be merged together. I wanted to split the question into smaller chunk so the merging part is left out. Solely: It is easier to merge in the new interval directly, instead of artificially … Read more