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.

~8K People Reached
Favorite Forums
Favorite Tags
c++ x 56
Member Avatar for timb89

im trying to output my bfs in this manner, showing the connections rather than the individual nodes: input 0 1 1 0 1 0 0 0 1 0 0 1 0 0 1 0 output (0,1) (0,2) (2,3) rather than: 0 1 2 3 this is my code so far, …

Member Avatar for alwaysLearning0
0
168
Member Avatar for timb89

im trying to get my code to perform dijkstra's algorithm on my adjacny matrix, it works great for the inital row (0) but i cant get it working for any other value?! [CODE]void dijkstra (int a[size][size], int matSize, string CityID[size]) { string startCity; cout << "Enter start city : "; …

Member Avatar for Taywin
0
144
Member Avatar for timb89

anyone have any ideas? for some reason uni forgot to include lectures notes on this, yet decided to base homework on it. i get the general idea just not sure how to implement it.

Member Avatar for SasseMan
0
3K
Member Avatar for timb89

I need to balance a binary tree which is in an array. [CODE]void balance(int lower, int upper) { int middle = (lower + upper)/2; cout << a[middle] << endl; if (middle!=lower) balance(lower, middle-1); if (middle!=upper) balance(middle+1, upper); }[/CODE] I've created the shell of the function just to get the idea …

0
94
Member Avatar for timb89

im trying to store preorder tree transversal into a stack though am getting a wide array of errors: to many arguments in void print_order, to many arguments in void preorder, and push has not been declared. any help please! [CODE]void print_inorder(BST *& p, stack <int> *& s);[/CODE] [CODE]void printOutText(BST *& …

Member Avatar for daviddoria
0
96
Member Avatar for timb89

im trying to write the post order print out of a preorder binary tree reading into a text file though everything i have attempted to do so far as resulted in an error. ive tried reading the preorder into stacks, queues, arrays, and the best ive been able to come …

Member Avatar for timb89
0
149
Member Avatar for timb89

One aspect of comp science that really lets me down is loop invariants. A question from a past paper that i cant get is to find the loop invariant of the following segment of code: [CODE]bool linearSearchIter(int a[], int n, int target) { int i = 0; bool found = …

Member Avatar for Narue
0
150
Member Avatar for timb89

Im trying to insert items into a BST from a txt file. For arguments sake the data file is just the integers 1 2 3 4 5 6 7 8 9. When i try to do a inorder traversal, all that is outputting is the first and last number. I …

Member Avatar for timb89
0
170
Member Avatar for timb89

i am trying to insert a 2 integer values into the linked list, but the program keeps crashing after it gets to inserting into a linked list. [CODE] struct termNode { int coeff; int exp; termNode * link; }; void insertHead(int c, int e, termNode * & P) { termNode …

Member Avatar for Kanoisa
0
98
Member Avatar for timb89

I am looking to allow the user to submit a polynomial such as +3x^6 +2x^2 +9x^0 into a set of variables which would be sent to a linked list. What is the best way to separate the variables to allow them to be looked at individually. So that: C E …

Member Avatar for timb89
0
85
Member Avatar for timb89

im looking at creating an adjacency matrix built with rows r1, and columns c1, with a float value. i have managed to read the the values from a text file, set out like: r1,c1,float1 r2,c2,float2 etc... i am having trouble converting these values into an adjacency matrix. thanks

Member Avatar for mrnutty
0
303
Member Avatar for timb89

i am trying to read the following information: [CODE]Carlingford,Epping,3 Epping,Marsfield,6.5 Marsfield,North Ryde,2.4 North Ryde,Epping,5 Carlingford,North Ryde, 3.5 Carlingford,Marsfield, 4.7 North Rocks,Epping,4.8 Carlingford,North Rocks,2.4 North Ryde,Ryde,2.1 [/CODE] so i will be able to store the information into a 2 strings and a float (obviously excluding the comma. eg: string station1 = …

Member Avatar for timb89
0
119
Member Avatar for timb89

[code] int countDigits(string word) { int count = 0; for (int i = 0; i < word.size(); i++) { if (word.at(i) < 57 && word.at(i) > 49) { count++; } } } [/code] i want to count the digits in a string "abc123". i know my problem is in the …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for timb89

(10 marks) Write a functiom in C++ which when passed 2 different lower case strings s1 and s2 will return true if the strings are anagrams. Note that 2 strings are anagrams if they contain exactly the same letters with the same frequency. im doing a past paper for an …

Member Avatar for kvprajapati
0
167
Member Avatar for timb89

10 marks Write a RECURSIVE function which when passed a string s will return true if s is a palindrome and otherwise false. A palindrome is a string which is the same if reversed eg radar, rotor, noon, racecar. past paper question which im doing at the moment as got …

Member Avatar for Stinomus
0
1K
Member Avatar for timb89

[code] bool isReverse(string s1,string s2) // pre : none // post : returns true if s1 is reverse of s2 and otherwise false { if (s1.length() != s2.length()) { return false; } int size = s1.length(); int count = 0; else { for (int i = 0; i < size; …

Member Avatar for ArkM
0
104
Member Avatar for timb89

[code] void deleteNegative(queue <int> &q) { queue <int> temp; if (!q.empty()) { int x = q.front(); if (x >= 0) { temp.push(x); q.pop(); } else { q.pop(); } } while(!temp.empty()) { q.push(temp.front()); temp.pop(); } } [/code] just afunction that returns a queue without the negatives in the same order. unsure …

Member Avatar for Sky Diploma
0
73
Member Avatar for timb89

[code] #include <iostream> #include <cstdlib> #include <cassert> using namespace std; struct node { int info; node *link; }; void insert(node *first, node *here, int x) { node *temp = new node; temp->info = x; if (first == NULL) { first = temp; } else { here->link = temp; } } …

Member Avatar for siddhant3s
0
70
Member Avatar for timb89

this is a homework task im completly lost in? we need to implement this header file below i like to think im pretty good at arrays and classes.... but the new additon of dynamic arrays has got me really confused... any help would be greatly appreciated [code] #include <iostream> using …

Member Avatar for ArkM
0
83
Member Avatar for timb89

i want to make a prgoram that will read in a set of numbers and determine whether or not they are prime numbers, this is what i got so far any ideas? [code] #include <iostream> #include <queue> #include <vector> using namespace std; int main() { queue <int> input; queue <int> …

Member Avatar for timb89
0
73
Member Avatar for timb89

[code] int log2(int n) { int count = 1; while(!n >= 1) { if (n%2 == 0) { count++; n=n/2; } else { count++; n=n/2; floor(n); } } return count; } [/code] not sure why it isnt working?

Member Avatar for timb89
0
121
Member Avatar for timb89

How do you read and display a 2d array? the input text is below i just really have no idea of tried everything :( any sort of help would be appreciated [ICODE]* . . . . . . . . . . . . . . . . . . …

Member Avatar for Sky Diploma
0
98
Member Avatar for timb89

i just started a new programming course and feel absolutley overwhelmed compared to my last one, we have to wrtie a program for the game of life. could somebody point me in the right direction, i am so confused right now... [url]http://www.comp.mq.edu.au/units/comp125/assignments/ass1/assignment1.html[/url] thanks! [CODE=cplusplus] #include <iostream> #include <fstream> #include <string> …

Member Avatar for Salem
0
90