Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

~13.3K People Reached
Favorite Tags
Member Avatar for aaronmk2

I am trying to get the height of a BST using a stack. I was told that I should use preorder and measure find the largest size of the stack. However, this does not seem to work. Any ideas of what I am doing wrong. [CODE] int PBT::maxDepth() { if …

Member Avatar for Taywin
0
170
Member Avatar for aaronmk2

I commented by the last line. I am trying to print out the string in reverse. [CODE] #include <iostream> using namespace std; void add(string n); int main() { string B ="ABCDEF"; add(B); } void add(string n) { if(n.length() <= 1) { cout<<n[0]<<endl; return; } else { cout<<n[n.length()-1]; add(n[n.length()-1]); //this lines …

Member Avatar for Euphan
0
76
Member Avatar for aaronmk2

I checked my php.ini file and there is no ; in front of extension=php_mysql.dll or extension=php_mysqli.dll. I think the I am getting this error because my figuration File (php.ini) Path is C:\Windows. How would I change it to C:\Apache2.2\php\php.ini? Also, once I have done this do I need to recompile …

Member Avatar for aaronmk2
0
174
Member Avatar for aaronmk2

I am trying to only have the words print out if they occur the same number of times as in the fibonacci sequence. If a words show up 1,2,3,5,8 etc then it will print up. I have gotten the program to print up the words based on how many times …

Member Avatar for vegaseat
0
99
Member Avatar for aaronmk2

For this program I am trying to figure out how to sort/print the words out based on frequency of appearance in ascending order. As of now I can only get the words to sort/print based on alaphabetical order [CODE] from collections import Counter import string while True: filename=raw_input('Enter a file …

Member Avatar for TrustyTony
0
3K
Member Avatar for aaronmk2

I am trying to combine the string NCards and Scards into one string called Tcards. I am using # include <cstring> and I get an error. How would I fix this. All the variables are strings. [CODE] void deck::deal() { Tcards=strcpy(Scards, Ncards); }[/CODE]

Member Avatar for Lerner
0
106
Member Avatar for aaronmk2

I am reading in from a file and when I use .eof() it read everything from the file the I get a run time error of Exc-Bad-Access. When I run a for loop instead the program runs with not errors. Any hints? [CODE] while (!inputFile.eof()) { inputFile>>number>>lowerRange>>higherRange>>cond>>aFName>>aLName>>phase; active=(cond=='t'); sAds[i] = …

Member Avatar for WolfPack
0
130
Member Avatar for aaronmk2

I want to read in multiple lines from a file, but I am only able to get my program to read the first line. The program prints out two other lines but the values are zero. [CODE] double cost[3]; int lowerRange[3]; int higherRange[3]; bool active[3]; ifstream inClientFile("ad.txt", ios::in); for (int …

Member Avatar for jonsca
0
150
Member Avatar for aaronmk2

How do I display the results of list<t>. I put rangeChecker objects in range and now I want to display the rangeChecker objects in range. How whould I do that? [CODE] static void display(RangeChecker[] rangeChecker, int SIZE) { //displays values for x, y, z, and how many times z was …

Member Avatar for Mitja Bonca
0
132
Member Avatar for aaronmk2

I always thought that if I used a switch statement and enter an option not specified the default would catch it. However, if I press enter then enter an option I get a run time error. How would I fix this? I am only including part of the code, if …

Member Avatar for Mitja Bonca
0
114
Member Avatar for aaronmk2

I am putting 20 objects in an array then I am using a bubble sort (not the most efficient, I know) to organize the set from highest to lowest. I am wondering if there is a way to do this without using sets (mutators)? Code is below. using System; using …

Member Avatar for aaronmk2
0
93
Member Avatar for aaronmk2

I am trying to write a trigger that updates a column called CUST_BALANCE in a table called CUSTOMER when new data is entered into another table called INVOICE. What I want to do is when new data is inserted into INVOICE it will take the value in column INV_AMOUNT and …

Member Avatar for MeSampath
0
112
Member Avatar for aaronmk2

Is their a way where the user could type Low to use the enum instead of typing 1? I know how to do this with strings, but am having trouble trying to figure it out using enums. [CODE] public enum Volume : byte { Low = 1, Medium, High } …

Member Avatar for aaronmk2
0
124
Member Avatar for aaronmk2

I am getting this error object reference not set to an instance of an object and cannot figure out how to fix it. I can get the program to when I only have one Timepiece object, but when I try more I get the error message. I left a note …

Member Avatar for aaronmk2
0
223
Member Avatar for aaronmk2

I am using split to split a string into a int, int, string. When I try int, string, string my program works fine. When I try int, int , string I get a run time error of an input string was not in a correct format. I am leaving a …

Member Avatar for ddanbe
0
99
Member Avatar for aaronmk2

When I read in this file it reads in the entire line. [CODE] string filename ="f:\\date.txt"; FileStream f = new FileStream(filename, FileMode.Open); StreamReader stream = new StreamReader(f); int line; int[] array = new int[15]; for (int i = 0; i < 15; i++) { line = stream.Read(); // header line …

Member Avatar for aaronmk2
0
88
Member Avatar for aaronmk2

My program runs, but I am getting this message which I am fairly sure means that I have a memory leak and it is coming from my destructor. Assignment2(779) malloc: *** error for object 0x100100120: pointer being freed was not allocated I don't know what I am doing wrong. Since …

Member Avatar for iopp
0
1K
Member Avatar for aaronmk2

I am writing a program using vector and am wondering if my destructor is correct, or do I need to add another line. The clear, clears all the elements in the vector, but do I need to add another line to delete the vector, and if I do what line …

Member Avatar for arkoenig
0
102
Member Avatar for aaronmk2

Can someone explain to me what is going on in this code. I am leaving comments by each line. [CODE] void qs::quicksort(int set[], int start, int end){ stack<int>s;//starts a stack to hold them elements s.push(start);//why push two elements, why not one so the while loop works s.push(end); while (!s.empty()) { …

0
58
Member Avatar for aaronmk2

I am having trouble with my quicksort. When I run my program it sorts them once( the lower half of the numbers are on one side, the higher half on the other). How can I get it to sort again without using a recursive function. [CODE] void qs::quicksort(int set[], int …

0
64
Member Avatar for aaronmk2

Can someone explain and give an example of how double hashing works. I understand linear, quadratic, and chain.

Member Avatar for vanalex
0
64
Member Avatar for aaronmk2

My profesor added this line of code to a bubble sort saying that it made it more efficient by tracking the last swap. I don't understand how this would work [CODE] void bubble_sort(int a[], int n){ while (0<n-1) { int last =0; for (int i=0; i<n-1; i++) { if (a[i]>a[i+1]) …

Member Avatar for Fbody
0
3K
Member Avatar for aaronmk2

I am having trouble figuring out what the recursive function does in the insert sort. Wouldn't the recursive line block the rest of the code from working. I am just looking for a quick explanation. [CODE] void insertion_sort-recur(int a[], int n){ if(n<=1) return; insertion-sort_recur(a, n-1);//how does this line work temp=a[n-1]; …

Member Avatar for mrnutty
0
998
Member Avatar for aaronmk2

I am pretty sure that the answer for this is n^3, because the 3rd for loop is executed n times and the middle is executed n+4 times and the top one is executed n times. I understand how to use sigma notation for the bottom and top for loop because …

Member Avatar for mrnutty
0
141
Member Avatar for peterman.k

I am going out of town and don't have access to my professor and / or tutors for the weekend, and we have an assignment involving a BST. I have done all of my insert, remove, and search functions, and went to the tutor about the remaining ones I have, …

Member Avatar for peterman.k
0
227
Member Avatar for aaronmk2

I an trying to find the height in a binary search tree. I figured out how to count the leaves going directly left and directly right, but cannot figure out how to get he leaves in the middle. [CODE] int BST::height(){ int tall =0; int tall1=0; BinNodePtr ptr=myRoot; if (ptr->left …

Member Avatar for mrnutty
0
139
Member Avatar for aaronmk2

I am using an overloading operator to add two polynomials. I have gotten it to work, but I am wondering if I can improve on my if statement by not changing the value of degree for the rest of my program. The if statement is used if the second polynomial …

Member Avatar for caut_baia
0
156
Member Avatar for aaronmk2

I am multiplying two polynomials and cannot figure out how to add the exponents. The loop is to multiply the coefficients and degree is for the total degrees used in the polynomial. But I can't figure out what I should use to add the exponents. [CODE] Poly Poly:: operator*(const Poly& …

0
72
Member Avatar for aaronmk2

I am writing a program where the user inputs two polynomials, then the program adds them, multiplies them, and evaluates one of them. I am having two problems. First, I can't think of how to add the exponents in the overloaded method for *. Second when the two polynomials multiply …

0
62
Member Avatar for aaronmk2

I am trying add two polynomials by overloading the + operator. When I run the program it only adds the first coeficients. I cannot figure out why it is only returning the first coeficient. [CODE] //header file #include <iostream> using namespace std; #ifndef _POLY_H #define _POLY_H const int CAPACITY =100; …

Member Avatar for gerard4143
0
120