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
ADVERTISEMENT
Dec 28, 2011
I have a not too complicated problem which I do not know how to solve in vb2010. Currently I have a recurive routine for finding files/and or searching. With a recursive routine I never complete the call until the end and process growth is significant enough to radically slow down the process with the now large stack. To make maters worse, I use precoding routines which will take wildcards. which are these:
[Code]...
View 1 Replies
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
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
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 15, 2010
i have an error when im using a function in dll. i declare this( "Private Declare Function SetChannel Lib "StreamReader.dll" (ByVal freq As Long, ByVal smyb As Long, ByVal pol As Long, ByVal fec As Long, ByVal lof1 As Long, ByVal lof2 As Long, ByVal lofsw As Long) As Boolean") [Code]
this is that error"A call to PInvoke function 'skynet!WindowsApplication1.Form1::SetChannel' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.".
View 1 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
Nov 6, 2010
I have created a webcam application in vb2010, when I run the app I get a run time error, please see below PInvokeStackImbalance was detected Message: A call to PInvoke function 'WebCam!WindowsApplication1.WebCamMainForm::SendMessage' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
it is coming up on this block of code'This sub will open the preview window
Private Sub OpenPrewiewWindow()
Dim iHeight As Integer = WebCamPictureBox.Height
Dim iWidth As Integer = WebCamPictureBox.Width
[code]....
View 2 Replies
Feb 11, 2012
My current code: Server: Imports System.IO Imports System.Text Imports System.Threading
[Code]...
View 9 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
Aug 5, 2010
I have a base class foo that will be used in multiple child classes of similar but slightly different function:
Public MustInherit Class foo
Public Function bar1() as Something
''// Perfectly OK to change what this method does
[code]....
How do I get the compiler to generate an error when bar2() is overridden by a child class?
View 2 Replies