185 Topics
| |
Hello, I'm trying to write a program that takes an input file name and lists the folders in a heirarchy ex.Folder subfolder etc I have most of my code, but I'm getting 2 errors that are connected and I have no idea how to fix it. Here is my code: … | |
How should I make an entry appended to existing entries instead of overwriting the whole file ? class ReadWriteCustomPathsToDisk(object): """docstring for ReadWriteCustomPathsToDisk""" def __init__(self, modulePath): super(ReadWriteCustomPathsToDisk, self).__init__() self.modulePath = modulePath def _xmlFileLocation(self): xmlFileLocation = os.path.join(os.path.expanduser("~"), "Documents","searchMethod","modules.xml") return xmlFileLocation if os.path.exists(xmlFileLocation): return xmlFileLocation def readXml(self): xmlFile = self._xmlFileLocation() root = etree.parse(xmlFile).getroot() … | |
[CODE]//To convert postfix expression into an expression tree #include"stdio.h" #include"conio.h" #include"process.h" #include"string.h" #include"stdlib.h" struct node{ char item; struct node *lnode; struct node *rnode; }*stc[30],*temp,*root; typedef struct node *NODEPTR; char expression[50]; char c; int top=0; NODEPTR pop(); void push(NODEPTR); void getinput(); void inorder(NODEPTR p); int main (){ getinput(); int i,j; for(i=0;i<strlen(expression);i++) … | |
I need help in building a binary tree and putting integers in it. I need to write an add method in my MyArrayBinaryTree class (that extends ArrayBinaryTree) that allows me to place the element to be added in the very next available slot in the array. I also need to … | |
Since the underlying data-structure used here is an array , which is itself iterable via `for-each()` , i'm wondering how much benefit implementing `Iterable` will provide here. I would appreciate if someone could review my code and suggest any further improvements. **Code:** import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; class ResizingCircularArray<E> … | |
Hi all, I want to create all possible combinations of a full binary tree which must have exactly 4 leaf nodes and 3 internal nodes. I want to create it using recursion and tree must be simple binary tree not a binary search tree or BST. Kindly suggest algorithm to … | |
Let's use the basic example.. I have a table for tree representation with just 3 columns: ID, PARENT_ID,NAME. If I delete a record X, how can I delete all recursive records that refer as PARENT_ID of deleted record? | |
I have created my binary tree as , It Shows in List Perfectly but i want to show in Genealogy , how can we do this ..I have Pasted My Total Nodes Script Here with HTML & java script for making tables & draw lines btwn nodes . When I … | |
Im trying to add Total function and isMono functions to this code. Did total already Need help with function ismono which returns whether a tree is mono (all the elements are unique aka no element appears more than one time) or not. Please this is the original program #ifndef T_H … | |
Hi, I need a function that will take a tree as argument and return the number of ints that were typed and a correct call. would it just be preorder? like below. Please. Thanks #include "t.h" void preorder(tnode * t){ if (t == NULL) return; cout << t->info <<endl; preorder(t->left); … | |
Hello All, So I'm working on hand-coding a forum-like website, just for the experience, and I want to have a similar feature as you'll see above where a thread will have its ancestors linked: "Web Development > JSP > Parent traversal of tree-like Structure" I have several beans for different … | |
Hi This code not run : it show this error: incompatible types-found java.lang.String but expected HuffmanCodingAnimation.Node This line of code ` root.left.code = root.code + "0";` Here is the code: import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.tree.*; /* * This program enables a user to enter text and displays … | |
Hi Everyone, I am trying to get the program below to work correctly. The line below is where I'm having trouble. (line 33 in PrefixCalc.java) calc = new ExpressionTree(new Scanner(console.nextLine())); When I run the program and enter "4 + 8", the scanner only picks up "4". Apparently this program was … | |
I have to write a program that creates a binary search tree from a file and output it and several other requirements. One requirement that I cannot figure out is how to find the search cost for each node. These are the instructions I was given Calculate the search cost … | |
I am doing huffman coding and I have made the tree. Now I am required to traverse the tree to create bit strings associated with the characters. Then I will put the bit string and char into a map to use with encode/decode. I have been working on this for … | |
Hi Guys, I am working on a binary search tree and I've been stuck on some code for the last couple of days. There are 2 issues that I can't seem to figure out how to fix. 1) I have a file that has a list of names and ID's … | |
class BTNode(object): """A node in a binary tree.""" def __init__(self, item, left=None, right=None): """(BTNode, object, BTNode, BTNode) -> NoneType Initialize this node to store item and have children left and right, as well as depth 0. """ self.item = item self.left = left self.right = right self.depth = 0 # … | |
I am having an issue implementing the Breadth First Search, Im trying to find the shortest distance between the source city and the destination city. Here is what I have so far, Im stuck and dont know what to do about this issue. #include <iostream> #include <string> #include <fstream> #include … | |
Hey guys, can anyone tell me how I could use randomaccessfile to read in a txt file and copy the content to a tree? Also how to then do the opposite and write newly changed nodes from the tree onto the text file? It's pretty much like creating a save … | |
Quick question. I'm studying for my CCNA and my supervisor gave me this challenge question. You're given 5x Cisco 3560's and 5x Cisco 3750's which are to be installed side-by-side on a rack. Which model would you choose to avoid issues with STP? I'm currently skimming over [this](http://www.cisco.com/en/US/prod/collateral/switches/ps5718/ps6406/data_sheet_c78-584733.pdf). Thanks!! | |
I got a java test done and somehow my answer for this question is incorrect, can you guys help me explain it? So the question is: in a binary tree with height 3 the least deep leaf has depth 2 (Root has depth 0). a)Max numbers of nodes this tree … | |
Hi! Lets say i have this expression I10I20I-3++ which should give me 27. I just cant seem to find a way of removing those I's or if it is any other letter from the string. Not forgetting i have to then evaluate the expression. I tried using regex but no … | |
Hi All, I have a binary search tree (consider following structure). struct bst { void *value; struct bst *left, *right; }; I want to save this unbalanced binary search tree in a file. And when I read this file, I don't want to recreate the tree from these nodes. So … | |
I want to create binary tree. With this program I wrote I have some problems. It seems the element I added to the tree is always added to the root place! Adding never happens to the left or the right subtree. This thing is prooved by result I always get … | |
Hi people. I have a remove function that should set a hide member of a node to 1 instead of actually remove the node. The function works well when I insert and remove top and tap respectively (both nodes have their hide member set to 1) but when I insert … | |
Hi everyone. I'm tying to understand the instruction below. I wish someone could explain me what it means: tree->destroy(((AvlNode*)(*position)->data)->data); // destroy the left branch of the binary search tree starting from the specified node static void destroy_left(BisTree* tree, BiTreeNode* node) { BiTreeNode **position; // can't remove from an empty tree … | |
Hello everybody. Here is my remove method for bst. As you all know, there are 3 cases to consider while removing a node from bst. For the last case, when a node (which is to be removed) has 2 children, I want to use predecessor instead of successor to change … | |
#include<iostream> #include<algorithm> using namespace std; #define MAX 10000000 #include<stdlib.h> #include<string.h> char s[MAX]; int p[MAX]; int bucket[MAX],nbucket[MAX]; struct suffix { int idx; }pos[MAX]; int H=0; bool cmp(struct suffix i,struct suffix j) { if(H==0) { return s[i.idx]<s[j.idx]; } else { if(bucket[i.idx]==bucket[j.idx]) { return bucket[i.idx+H]<bucket[j.idx+H]; } else { return bucket[i.idx]<bucket[j.idx]; } } } … | |
Here is my splay function: template <class WA> void SplayTree<WA>::Do_Splay(SplayNODE<WA> *temp) //temp is the node which is to be splayed { if (temp==root) //if temp is root then { return; } //Do Nothing else if (root->left==temp || root->right==temp) //else if temp is a child of root { if (root->left==temp) //if … | |
I have been struggling with the principles of creating a client-server design where the server maintains a data structure that multiple clients can view and manipulate with various restrictions on which client can access which parts of the structure. I don't know what to properly call a system like that, … |
The End.