637 Topics

Member Avatar for
Member Avatar for jonpadre

I am currently attempting to write a single [B]recursive[/B] method (per instruction) whereas the items in a binary tree are displayed in a horizontal hierarchical manner (level order traversal). The UML describes the method as: levelOrderTraversal(TreeNode<T> tree, Integer indent) - tree: a node in the binary tree - indent: describes …

Member Avatar for jonpadre
0
198
Member Avatar for kratosaurion

So here is my problem, my friend and I are writing a simple project for a electrical eng. teacher, who really doesn't know too much about programming c++. We were assigned to make a successive approximation ADC [URL="http://en.wikipedia.org/wiki/Successive_approximation_ADC"]Look here[/URL] in any coding language possible. I would have liked to make …

Member Avatar for kratosaurion
0
452
Member Avatar for bensewards

Hey everyone, I have to manipulate two functions RECURSIVELY, strlen and strcpy. I was able to code the strlen: [CODE]int length(char* str){ if(str == NULL){ return 0; }else{ return length(str, 0); } } int length(char* str, int l){ int len=0; if(str[l]){ len = length(str,l+1); } else { return l; } …

Member Avatar for bensewards
0
753
Member Avatar for jatpatel1

Hi there, Please can someone help me! I have recently been learning oop PHP. I have created a class for my database, which basically makes my life easier when doing queries. I have created a "where" method which basically when used will append to the select statement. For example: //class …

Member Avatar for diafol
0
210
Member Avatar for Deepo

[CODE]#include <iostream> using namespace std; int main( ) { int num1 , num2 , num3; cout << "Please Enter Three Valid Integers Using The Keyboard"; cin >> num1 , num2 , num3; if {num1 => num2} && {num2 => num3} else num1 + num2; if {num2 => num1} && {num1 …

Member Avatar for emanfman
0
249
Member Avatar for Hockeyfreak889

i need to make a program that implements a heapsort using a binary tree. i understand the algorithm for how to do the sort, and i understand how it would be done using an array, but for my class i have to use a binary tree. The problem i am …

0
78
Member Avatar for GreaseJunkie

I hate to post a thread on this since I know this topic has been discussed ad nauseum, but I've been searching for weeks and cannot find exactly the answer I've been looking for. I'm new to arrays and loops - I get the concept, but not the syntax. Here's …

Member Avatar for hielo
0
377
Member Avatar for cNew

Hi! What could be the best algorithm for "Merge Sort" where the memory must be used "most effectively"? I just know the standard way to do this, but that's not the most effective way how to use the memory. This is the only variant which I know: [CODE=c] #include <iostream> …

Member Avatar for Narue
0
209
Member Avatar for mushahidh

CONVERT THIS QUICK SORT PROGRAM INTO PARTITION OF 3,5,7OR 11 ELEMENTS. [CODE] #include"stdafx.h" #include<iostream> using namespace std; #include <stdio.h> #include <stdlib.h> #define size 50 void swap(int *x,int *y) { int temp; temp = *x; *x = *y; *y = temp; } int partition(int i,int j ) { return((i+j) /2); } …

Member Avatar for Momerath
0
219
Member Avatar for addbot101

/*Does the Bubble sort algorithm above sort the array into ascending or descending order?*/ void BubbleSort(int Data[ ],int ArraySize) { char sorted = ‘f’; int pass,a,Temp; pass = 1; while (sorted=='f' && pass<=ArraySize-1) { sorted = 't'; for (a=0;a<ArraySize - pass;a++) { if (Data[a] < Data[a+1]) { Temp = Data[a]; …

Member Avatar for rubberman
0
123
Member Avatar for stemiros

Hi, I have a list of base types which stores multiple derived types. The following code shows a simplified setup. [CODE]#include "Base.h" #include "DerivedA.h" #include "DerivedB.h" #include <iostream> #include <list> void main() { std::list<Base*> base; std::list<Base*> *basePointer = &base; for (int i = 0; i < 10; i++) { basePointer->push_back(new …

Member Avatar for mrinal.s2008
0
2K
Member Avatar for vineeth vs

pls any one tell me why the loop is not ending?? (program for quick sort)[CODE][/CODE] [CODE]#include<stdio.h> int partition(int a[],int l,int r); void quicksort(int a[],int low,int high); int loc,temp,pivot,a[50],low,high,left,right; int main() { int n,i; printf("\nEnter the no: of elements : " ); scanf("%d",&n); printf("\nEnter the numbers : "); for(i=0;i<n;i++) { printf(" …

Member Avatar for Narue
0
246
Member Avatar for kandyhyatt

I'm new to java and seriously needing some help..I'm having problems deciding accessor and mutator methods.. and how to create an ArrayList. Write a program that uses an ArrayList of parameter type Contact to store a database of contacts. The Contact class should store the contact's first and last name, …

Member Avatar for kandyhyatt
0
235
Member Avatar for rhuffman8

I just started looking at iterators in my C++ class and don't think I fully understand enough about them to actually create one. I need to add an iterator to this doubly linked list program: [CODE]#ifndef CSLIST_H #define CSLIST_H #include <iostream> #include <cstdlib> using namespace std; template <class T> struct …

Member Avatar for rhuffman8
0
276
Member Avatar for lauw0203

Hello :) I'm creating a license plate recognition system for my coursework at University. We need to use Binary trees, which I've done but the information needs to be stored in a file to read and write to. I've created some text files with XML tags in for Cars, Lorries, …

Member Avatar for lauw0203
0
177
Member Avatar for fibbo

Hey, it's me again. Again with a topic that has been covered here but reading through the old threads didnt help me to solve my problem. And I am pretty clueless at the moment. Consider the class passenger_queue with 2 functions, namely: [CODE]int passenger_queue::get_passengers_waiting() const { // Insert your code …

Member Avatar for fibbo
0
7K
Member Avatar for Thendi

Hi I am trying to put quicksort in my class like other methods and call it using the main method, I did it for Selection, Insertion, Bubble Sort and I need one more which is quicksort. I already made the calling code for quicksort but I don't know how to …

Member Avatar for Thendi
0
650
Member Avatar for lil_miss_choc

I'm working through an exercise to create a short program to calculate E using the series 1 + 1/1! +1/2! + 1/3! + ... The summation has to stop when value of a term is less than a value entered by the user. The code I have to produce the …

Member Avatar for lil_miss_choc
0
227
Member Avatar for fuaki

Hey, I made this code with the bits and pieces of knowledge i have, but i don't know how to convert it into a while loop. it is currently in a for loop. the program counts how many certain letters there are in a sentence/ word. String word; String letter; …

Member Avatar for turt2live
0
179
Member Avatar for stan2000

I'm trying to write a method that draws a rectangle. If the user enters height = 4, and width = 8, and the print of character " * ", then the left rectangle is drawn on the left if the filled flag is true. If the flag is false, then …

Member Avatar for richieking
0
2K
Member Avatar for sirlink99

I have a little problem with my if statement. I have a code where I am comparing if a sprite has moved far enough for another one to generate behind it. Here it is (the dots are choped out code): [CODE]if (unit > 0) { if (moved > speed + …

0
81
Member Avatar for CrumbledCookies

Would somebody please assist me? I have been consistently been doing trial and error with my counter. You see, when the program cannot locate an item (which is typed at the bottom) it displays "Sorry, no such item number exists, please enter another one or 0 to stop." Every time …

Member Avatar for CrumbledCookies
0
355
Member Avatar for crankyslap

Hey guys, I'm seriously breaking my head over this one. This project should have been finished 10 hours ago but I've been stuck on this for ages. First I set the DataSources / Dataviews of all the things I need; [CODE] Dim dsPubs As New DataSet() dsPubs.ReadXml(pathdone) DataGridView2.DataSource = dsPubs.Tables(0) …

0
107
Member Avatar for battlex2010

i have the following code for getting the number of files on a drive: [CODE] Dim num As Integer = 0 Dim drive As String = "C:" For Each File In System.IO.Directory.GetFiles(drive,"*",System.IO.SearchOption.AllDirectories) Try num += 1 Label5.Text = String.Format("Files found: {0}", num) If num > 50 Then RaiseEvent start() End …

Member Avatar for Unhnd_Exception
0
194
Member Avatar for jrotunda85

I've been messing arround with this for the past little while and I can't seem to figure out the best way to to about doing this. Essentially, I'm trying to create a three part statement. The first will check is a session variable isset & the user has a rolecd …

Member Avatar for jrotunda85
0
363
Member Avatar for tekboi

I'm trying switch the twitter javascript widgets out depending on the time. So in the day, the twitter widget will be colored differently than at night. I used the code that twitter gave me and came up with this code. But I get a syntax error in DW on the …

Member Avatar for Taywin
0
191
Member Avatar for insanely_sane

Ok, so you know how, if we want to output the elements of an array to the screen, we have to make a for loop right? So I have the following code... [CODE] char array[] = new char [10]; array[0] = '1'; array[1] = '2'; . . . . array[9] …

Member Avatar for jon.kiparsky
0
2K
Member Avatar for rockerjhr

I need to use mergesort to sort the data in a file that has the names and ages of 10 different people , first i have to sort the names in ascending ascii order and then i have to sort them by their age but im not sure how to …

Member Avatar for rockerjhr
0
213
Member Avatar for jaku78

Hi. Basically I first made some code to do mergesort on a list of numbers. Worked like a champ. Then I said, what the heck, why not do a mergesort on an array of structs, this is where it gets a little funky. While the first sort of the data …

Member Avatar for dkalita
0
106
Member Avatar for PtblDuffy

Hello, I've been looking at this problem for a few hours, and I can't figure it out. We had to test this code and fix it if we find errors (it's a splay tree): [CODE] public class SplayBST { Node root; int count; int level = 0; public SplayBST() { …

Member Avatar for PtblDuffy
0
218

The End.