Recursive Function Vs Factorial Function
Nov 20, 2009
Can someone explain to me what the difference is between a recursive function and a factorial function. I know that a factorial function returns the product of all the numbers from 1 to itself. But how does that differ from what a recursive function does
View 2 Replies
ADVERTISEMENT
Nov 28, 2011
I am hopeing someone can help me here with a recursive function I have that is not returning either true or false as I would have espected it to. The function loops through a Active Directory group for its members and then calls itself if it encounters any groups within the membership in order to gets its members as well. I am trying to return either true or false based on if any errors were encountered but not haveing any luck at all. It appears to just hang and never return back to the primary calling sub that starts the recursive function. Below is my code I am using:
[Code]...
View 1 Replies
Jan 17, 2011
I have the following data in this a table
ID ParentID Active Node
1 0 1 <RCExtRequest>?</RCExtRequest>
[Code]....
If changing the table layout would make this any easier then I could so that.
View 2 Replies
Feb 11, 2011
i have these 2 functions that search for any .jpg files starting from a given path the algorithm works, it's just that it freezes up the gui at times this is why i wish to know how to implement it through a new thread or a backgroundworker maybe.[code]
View 2 Replies
Mar 12, 2011
I'm making a program that can mark my shooting cards and i have created it and it works nicely But i want to get as much speed out of it as possible so I switched my target CPU to X64 and sure enough my recursive function threw a Stack overflow exception telling me i need to make sure i don't have Infinity recursions. Strangely when I set It back to X86 the same recursive function works...
vb.net
Dim bullethole As New List(Of Point)
Function GetBulletHole(ByVal point As Point) As Point()
[Code]....
View 12 Replies
Nov 21, 2009
Is it possible to use a recursive function on an array
If I have an array like this[code]...
I want to use a recursive function to make in out like this[code]...
View 4 Replies
Dec 8, 2009
I have a recursive function in this function i am adding some value to path variable here i want to acess this value outside of function for this what changes i will do in this function.
Private Sub GeValuePath(ByVal ParentID As Integer)
Try
dim path as string =""
[Code]......
View 1 Replies
Feb 11, 2010
have an xml file like this.
<?xml version ="1.0" encoding ="utf-8"?>
<menu>
<menuNode title="Register" value="true">
[Code]....
View 2 Replies
Feb 14, 2011
I have 3 variables. Lets call it "a", "b" and "c". These 3 variables can "independently" have 3 different values. Lets say: "1", "6" and "10". when you think of them as combination; there are (3^3) 27 combinations. I am told that it can be done through the recursive functions. However i am not a good developer to handle with that. Would u please help me?
- 3 variables and 3 different values are simplified. In fact; the numbers of variables and different values can vary.
- i know only the language, visual basic in .net; please don't answer in other coding languages.
additional note: i am going to put the these combinations in the string format into a collection.. for example "1;1;1", "1;6;1", "1;6;10".. and so on..
View 7 Replies
Aug 16, 2011
I have a recursive function wich objective is scan an structure and represent that structure with treenodes. Inside my function depends the structure I'll have to create another treenode inside my treenode or just create a node. My problem is that I don't know how to remember my treenode position when I have to call my function again.
If strTop.TextString.ToUpper = "DMN" Then
gcTreeno.Nodes.Add("Node")
Else
Dim perf As New TreeNode
gcTreeno.Nodes.Add(perf)
End If
if i would like to write next time a node into perf, how i could do it?
View 1 Replies
Nov 21, 2009
How can I use a recursive function to remove a character from a string thats stored in a array.
Like so
MMMMM
MMMM
MMM
MM
M
I need to remove a letter from the string each time it loops through the string until there is only 1 letter left in the string.
View 7 Replies
Mar 2, 2012
I'm hoping to improve the performance of the below as well as return the GUID of each user.
I've converted and modified the code found here for searching through groups recursively to get all the members and their details and adding them to a class collection. However I also need to capture the user's managers details so I'm calling the AD twice for each user. This doesn't seem efficient as many of the users will have the same manager. It would seem logical to get the distinct manager details from the collection class and call only these, then replace them wherever they occur in the collection.
I'd also like to be able to get the user's GUID, I've tried accessing it directly as a property of the collection, but it doesn't return anything.
I'm using vs2005 and .Net 2.0
Public Class ADCLass
''' <summary>
''' Calls recursive function to return users in group
[Code]....
View 1 Replies
Apr 6, 2009
this its a function i made to make sure all the fields on a form are filled before to save to database but once it finds a object it should exit. but it just doesnt... i tried also with exit for and exit sub also tried puting the exit for just after the msgbox shows up but it wont exit, this its the last thing i did using a flag but it doesnt exit either.
[Code]...
View 10 Replies
Dec 29, 2009
I got that little function(I changed the name of variables)
Private Function everythingLinked(ByRef myClass As cls, ByVal found As Boolean) As Boolean
If Not found AndAlso myClass.checked = False Then
myClass.checked = True
[code]....
I want to rewrite it so it would only be loop and no recursion and I'm currently lost?I'm passing a class to this function(with a starting value for found as false) to know if it is linked to the middle of the tree. The class got an array with a maximum of 4 link to other class and it can be circular(this is why I have a checked_link boolean).It does the recursion until there is no more link(return false) to check or until it find the middle link(return true).
edit?for an example, this
in pos 0 got link with 1
in pos 0 got link with 6
in pos 1 got link with 0
[code]....
middlepoint would be pos 15 the code above can prove that every position can be linked with the middlepoint so initial arg would be
everythingLinked(random pos, false)
and in this case it would be always true
View 5 Replies
Mar 23, 2011
i have been asked to turn a recursive function into a stack base but i am not sure what that's mean but i choose the fibonacci recursive function and i turned it into the stack base ?Public Function fib(ByVal value As Integer) As Integer
Dim x As Stack
x = New Stack(30)
Dim temp As Integer = 1
Dim result As Integer = 0
[code]....
View 3 Replies
Aug 18, 2010
I'm trying to make a simple game tree.Previously I used nested loops:
[Code]...
View 10 Replies
Oct 21, 2010
I am looping through all folders on the computer in a background worker. Starting with just the C: drive, the function works perfectly I've been tasked with adding recursiveness to this function to loop through all subfolders within each and every folder.
This is the working code without recursive. Startpath is set = "c:".
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim fs As New FileSystemObject
Dim fsfolder As Folder
Dim subfolder As Folder
[Code]...
EDIT: I was doing some testing and threw in an if check to skip the C:$ folders. Working ok so far and noticed something really strange. It doesn't loop through all the folders in the C: drive. I think it will loop through only the first 2 folders. One is C:Boot so I skip that and the other is C:Dev-cpp. It won't loop through the Program Files, Program Files (x86), or Users.
View 4 Replies
Oct 25, 2010
I am descending all the directories of my C drive to get a complete list of all extensions.When I get to: C:Windows.oldDocuments and SettingsAll UsersApplication Data
the program goes into a loop: C:Windows.oldDocuments and SettingsAll UsersApplication Data Application Data Application Data until the path exceeds maximum length (248 characters for the directory).
[Code]...
View 3 Replies
Dec 2, 2008
I am trying to write code to save (in a text file) a list of folders/files that are contained in a specified folder. I want the list to be formatted to illustrate the folder tree structure by indenting sub-folders and there related files according to their relationship to the base folder.
I found and incorporated a recursive function for listing file & folders. This works fine for generating the list, but I am having difficulty with code to determine the sub-directory level relative to the base folder. the code that I have included below sort of works.......The problem seeme to be when going from a folder that is multiple levels up? from the base to one that is only one level from the base. Refer to my sample output. This should not be as difficult as I seemed to have made it, but recursion kinda blows my mind.
Code:
' The following function call is in a button handler
GetFilesFolders(txtBaseFolder.Text)
Public Sub GetFilesFolders(ByVal path As String)
[code]....
View 2 Replies
May 9, 2010
I am working on networks. My work involves finding out what nodes connected to a specific node (Source node). I have developed a code which does this using a recursive function. The only problem that I have I need to record the path. For example shown in the picture below, my program give me the following results[code]...
View 1 Replies
Feb 11, 2012
I am currently using a recursive function to retrieve all the files/folders within a directory.Sometimes this takes a while. I am wondering if I am able to calculate the total number of files/folders within a directory before retrieving the filenames so that I can implement a progress bar?
View 1 Replies
May 10, 2010
I am working on networks. My work involves finding out what nodes connected to a specific node (Source node). I have developed a code which does this using a recursive function. The only problem that I have I need to record the path. For example shown in the picture below, my program give me the following results:
1 Node 3 is conncted to 1 via 1
2 Node 5 is conncted to 1 via 3
3 Node 4 is conncted to 1 via 1
[code].....
View 2 Replies
Jun 18, 2010
I want to exit a recursive function once the a number is repeated in a list. i.e. In the following code I have 'AST' as a list. How can I stop adding data to the list once the first number repeated?
The result in the below code is:
1 2
4 5 1 2
4 5
1 2 4
5 1
2 4 5
1 2
4 5 1
1 3
3 5 6
3 3
1 3 3
5 6
3 3 1
3 3
5 6 1
5 6
1 5 6
1
What I want for AST to be: 1 2 4 5 1, because 1 is repeated.
Just Add to your form a richtextbox and a button.
Public
Class Form1
Dim TheConnectionsValue(6, 6)
As Integer
Dim NumberOfNodes
]Code] .....
View 4 Replies
Aug 26, 2009
i'm trying to build websites crawler and i having a bit of problem creating recursive function to get all the site link, provide a link to an example ?
View 2 Replies
Oct 12, 2011
I want to make an numerical integration method with takes in an analytic function and integrate it over a specific interval. For the numerical integration procedure I want to use some procedures in nr.com. The problem is that these are programmed in C++ and they uses functors to pass a function to the integration method. How can I do this in VB 2010?
I want to initialize the function (i.e. set a=1,b=0 for function y(x)=a*x+b) and then pass the function to the integration method. Then when the integration method call the function it only calls the function with one parameter (i.e. x since a,b is already set)
What is the best way to do this in VB2010?I want to make a general integration method where I can pass any single valued function and integration limits.
I have just started using VB, and from what I have found so far it seems like the tools you have is
- to us a delegate for the function
- to use a lambda expression for the function
- send a pointer/adressOf
- to create a function class/structure and submit this to the function
As for now I am most inclined to create a function-class. But I am not really sure how.F.ex. I make different classes for each "uniqe function" I want to integrate, but how can I pass them to the integration function when I need to specify the argument type in the integration-function-call?This seems like a basic problem which applies to many Math operations, so I think it would be very useful to clarify this.
View 2 Replies
Apr 1, 2010
I'm trying to undersatnd the syntax of calling a funciton and it seem confusing when I'm using a web service in ASP.net. Maybe this question should be in an ASP forum, but it is a VB question. This simple web service allows you to type in your name and it response with an alert box with you name.
My question is, How can you call a function with 2 arguments when the function is only defined for one. I understand that the second argument is actually a method that handling the respons, but how can you interchange function arguments for methods and how do you know that there are methods for
Here's my call:
<script type="text/javascript">
function HelloWorld()
{
var yourName = $get('txtYourName').value;
[CODE]...
View 7 Replies
Feb 12, 2009
I've been running this recursive function below and it keeps crashing my server. If I change the recursive part "checkparent = checkparent(xmlsrc, cnt2)" to "checkparent = "none"" it doesn't crash. I through in the cnt2 integer so that if it got further than 10 levels deep it'd stop, that way it shouldn't get into an endless loop.
CODE:
View 5 Replies
May 25, 2012
I am trying to convert a DLL function call which has the Callback function routine called within the DLL function call.The DLL function call signature is like this:
typedef void *HANDLE;
typedef HANDLE HACQDESC;
DECLARE_HANDLE (HWND);
[code]....
how to convert this DLL call to VB.NET and also how to create the callback function and send it as parameter to this function
call.
View 15 Replies
Aug 1, 2009
i wanted to ask how to make picturebox1 ,to which functions are already assigned, perform the same function as picturebox2 ,to which no functions are assigned.For example:I have already made picturebox1 and have assigned it alot of function like when play button is pressed then picturebox1.visible = true and when we press pause button picturebox1.visible = false. So now i decided to make a theme and have to remove the picturebox1 and want to allow the picturebox2 to havefunction of picturebox1.But when i disable the theme the function of picturebox1 should go back to picturebox1.
View 6 Replies
Dec 13, 2011
I need to execute a stored function in oracle or sql through vb.net. I created a command object. Depending on the database type(oracle or SQL) i am preparing the Command text as Select functionName(?,?,?,?,?,?,?,?) from dual; (For Oracle) Adding the parameter values of the function. Now performing the ExecuteScalar which is not working saying invalid parameter. This works with ODBC connection string. But ODBC doesn't with 64bit. My Requirement: Code should execute a user defined stored procedure by taking the values at runtime.
View 1 Replies