Use A Recursive Function On An Array?

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


ADVERTISEMENT

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

.net - Recursive Function Not Returning?

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

Designing A Recursive Function?

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

How To Run Recursive Function In Different Thread

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

Recursive Function Works On X86 But Not X64?

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

Access Variable Outside Of Recursive Function?

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

Recursive Function Is Not Working Properly?

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

Recursive Function Using 3 Variables With 3 Different Values

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

Recursive Function With Dynamic Treenode

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

Using A Recursive Function To Remove A Character?

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

Improving Recursive Active Directory Function?

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

Recursive Function Won't Exit Code Inside?

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

Rewrite This Recursive Function To Remove The Recursion?

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

Turn A Recursive Function Into A Stack Base?

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

VS 2005 Nested Loop Vs Recursive Function?

Aug 18, 2010

I'm trying to make a simple game tree.Previously I used nested loops:

[Code]...

View 10 Replies

Working Function Adding Recursive Breaks It?

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

An Infinite Loop In A Recursive DirInfo.GeDirectories Function?

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

File I/O And Registry :: Using Recursive Function For Directory Tree?

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

Record A Path Of Sequence In Program Recursive Function?

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

Using A Recursive Function To Retrieve All The Files/folders Within A Directory?

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

VS 2008 Record A Path Of A Sequence In A VB Recursive Function?

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

How To Exit Recursive Function And Record Required Data To List

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

Website Crawler Creating Recursive Function To Get All The Site Link

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

Recursive Function With "governer" Still Crashing My Server ?

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

Passing An Array Of Integer To An Array Of Object In A Function

Mar 4, 2012

I am creating a dll with all the functions and subroutines that I use all the time and I decided to create a function that I can pass different types of array to so the function obviously (or not) would have an array of type object. Now I no you can pass any type into an object type but when I pass an integer array into an object array I get an error.

value of type '1-dimensional array of integer' cannot be converted to '1-dimensional array of object' because 'integer' is not a reference type.

Shared Function CompareArray(ByVal FirstArray() As Object, ByVal SecondArray() As Object, Optional ByRef ErrorMessage As String = "") As Boolean
Dim IntArrayOne() As Integer = {1,2,3,4,5} Dim IntArrayTwo() As Integer = {1,2,3,5,6} Dim IsSame As Boolean = False IsSame = CompareArray(IntArrayOne(), IntArrayTwo())

View 2 Replies

Passing Array Function. Searching Array For Characters?

Nov 1, 2011

I previously posted a Question about code that uses a function to return the frequency of characters in an array. I have now got this code.

View 5 Replies

A Way To Do A .Where(function(x) X.id In [array])?

May 15, 2012

I want to filter a list of entities that I am fetching from a database. In fact, I should be getting only 1 entity back and I want to make sure its category is one of the allowed ones. What's the best way to filter? My first thought was to do something along the line of :

[code]...

Of course, it doesn't work and I'm having issue finding documentation on that "Where".

View 1 Replies

Call An Array From Another Function?

Mar 30, 2011

I'm trying to call an array from another function into an argument command for a command prompt, but I have no clue on how to do so.This code is the code where I am calling the command prompt and adding arguments

Private Sub ConvertButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConvertButton.Click
Using m_Process As New Process()

[code].....

View 2 Replies

Call Function Using Array Value?

Apr 22, 2012

I would simply like to know if it is possible to call a function using a string value.

As an example i have many functions called "openford","openvauxhall","openmini" etc.

So what I mean is, can I put all those function names into an array, then pull a name from the list and call it.

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved