Hi,
I've been working on a site that uses binary mlm system.
Illustration here
So I have a two tables in database, users anad relationships. There is ID and personal data columns in users. Relationships has 4 columns: ID, parentID, childID, pos. Where pos is either left or right.
I have succesfully written a function that recursively...
Hey there!
I've wrote this simple piece of code. And I have a slight problem with it.
int [] x = [50,70,10,12,129];
sort(x, 0,1);
sort(x, 1,2);
sort(x, 2,3);
sort(x, 3,4);
for(int i =0; i<5; i++) Console.WriteLine(x[i]);
static int [] sort(int [] x, int i, int j){
if(j ==x.length) return x;
else if(x[i]>x[j]){
int temp = x[i];
x[i] = x[...
Hi,
I am preparing for an interview and have been stuck on this question for quite some time now. Could anybody please help me with the code. If not complete then may be a snippet of it?
Please..
...
I'm interested how can be implemented recursive regexp matching in Python (I've not found any examples :( ). For example how would one write expression which matches "bracket balanced" string like "foo(bar(bar(foo)))(foo1)bar1"
...
I have a binary, the database table of relationships looks like this:
+----+----------+---------+-----+
| id | parentID | childID | pos |
+----+----------+---------+-----+
| 1 | 1 | 2 | l |
| 2 | 1 | 3 | r |
| 3 | 2 | 4 | l |
| 4 | 3 | 5 | r |
| 5 | 4 | 6 | l ...
The type of this function is function :: Num a => ([Char],a) -> ([Char],a)
My input for this function would be something like function (".'*",0) and the function finds the first '.' or '*' and updates a, by adding 200 or 400 to a's value depending on which character was replaced first. Once something is changed, the rest of the charact...
I have a recursive function that takes a Map as single parameter. It then adds new entries to that Map and calls itself with this larger Map. Please ignore the return values for now. The function isn't finished yet. Here's the code:
def breadthFirstHelper( found: Map[AIS_State,(Option[AIS_State], Int)] ): List[AIS_State] = {
val exten...
What am i doing wrong? Simple recursion of few thousand deep throws "StackOverflowError"
If the limit of Clojure recursions is so low, how can I rely on it ?
(defn fact[x]
(if (<= x 1) 1 (* x (fact (- x 1)) )))
user=> (fact 2)
2
user=> (fact 4)
24
user=> (fact 4000)
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
...
I have a database that has node & nodetype tables.
Nodes table
NodeID
ParentNodeID
NodeTypeID
NodeName
...
NodeType Table
NodeTypeID
ParentNodeTypeID
NodeTypeName
.....
Both tables have a relationship to itself.
There are different types of node i.e
Node
Site
Building
Office
These are hierarchical, so information (attributes) th...
I'm making my way through "Programming in Scala" and wrote a quick implementation of the selection sort algorithm. However, since I'm still a bit green in functional programming, I'm having trouble translating to a more Scala-ish style. For the Scala programmers out there, how can I do this using Lists and vals rather than falling back i...
Hi everyone. So, I was reading about linked lists and recursion. I just wanted to know why can't I use recursion in a method that is static void? Also, I was wondering in Java in the linked list recursion, why you can use static void in printing or search for the nodes. Thank you.
...
My c# service got an internal .net execution error that points to recursion issue (e.g. stack overflow). The problem is that the service is pretty large, so I am having trouble finding where the recursion actually occurs.
Can someone with massive regex mojo hook me up with a search string that would find what I need?
...
Hi I have a which references itself and I need to be able to select the parent and all it's child records from a given parent Id.
My table is as follows:
ID | ParentID | Name
-----------------------
1 NULL A
2 1 B-1
3 1 B-2
4 2 C-1
5 2 C-2
So ...
My DjangoApp is using categories to generate a navigation and to put stuff in those categories.
There are two types of categories:
ParentCategories (top categories)
ChildCategories (sub categories that have a ParentCategory as a parent)
Because those to categories are so similar I don't want to use two different models.
This is my c...
I've got a content management system that contains a hierarchical structure of categories, with sub-categories subject to different ordering options at each level. Currently, that's retrieved by a (rather large) series of queries...but I'm attempting to speed things up by using a recursive stored procedure.
(As I understanding, using CT...
I have a program that is supposed to read in values from user into a vector. My function is then supposed to keep a running sum and start from element 1 and compare element 2 to the sum(this point it is just element 1). Move to the next element, add element 2 to the sum and see if element 3 is greater than the sum of elements 1 and 2. ...
Hi.
Let's say that we have two boxes of pencils (in first box just blue and in second just red pencils). So the question now is, in how many ways can we put x red and y blue pencils in the line?
Example: we have 3 Red pencils, and 1 Blue. Then we have 4 different ways.
Combinations: BRRR, RBRR, RRBR, RRRB.
So with 10 Red and 10 Blue ...
Create a recursive function to print a multidigit number vertically. For example, 2378 should be
printed
2
3
7
8
Test your program with numbers of different length.
...
The question is related to the answer about renaming files recursively.
The code, changed to replace dashes, does not work with cases such as:
./Beginners Tools/Hello's -Trojans-/bif43243
./Linux/Nux Col - 1 Works (TEX & Pdf) - T'eouhsoe & More (33323 - 34432)
./Git/peepcode-git-mov/c6_branch_merge.mov
./haskell/OS 2007 - T aoue
./B Si...
Hi folks,
been struggling with this for a couple of days now and still stumped.
i have a data structure that starts with containers that can hold other containers, and eventually leaf nodes. i'm looking for a way of being to iterate thru elements of a type directly, without pulling them into another collection so i can operate on them i...