405 Topics

Member Avatar for
Member Avatar for flyingcurry

I have a prime number method here which checks if the user input is a prime number, I've done some stuff to try to make it more efficient, but I am wondering if there is anything else that can be done, maybe even make the complexity class constant? Thanks. Below …

0
108
Member Avatar for EricMack

[ATTACH=right]17425[/ATTACH]Swedish start-up [URL="http://saplo.com"]Saplo[/URL] wants to put the entire online world into context to help slice through the deluge of irrelevant information - and they're trying to do it by shifting from syntax-based search to algorithms based on high-profile academic research that understand the semantics underlying all that overwhelming amount of …

0
363
Member Avatar for flyingcurry

For homework, we have to find the time complexity class of certain algorithms and explain why it has that certain complexity class. So, I have a couple of questions: - Why is the first running time always so much longer than the ones after? (setting up the application or something??) …

Member Avatar for tong1
0
211
Member Avatar for flyingcurry

We have an assignment to write a program finding the nth Fibonacci number. On the web, there are some standard mathematical equations for this, but that would just defeat the purpose of this assignment if I use those formulas. I have my current code down here(with some sketchy back up …

Member Avatar for coil
0
1K
Member Avatar for scholar

Hello friends, I have a dynamic programming problem and would like to discuss it here.The problem goes as Given an integer array A[0....i] convert it to an array of strictly increasing numbers. The operations allowed are 1)Decrease an element by amount x: cost of operation=x 2)Delete an element k: cost …

Member Avatar for Adak
0
158
Member Avatar for kebbby

Please help with this new sorting algorithm. I implement it on VB but i cant get a correct output. It's a new sorting algorithm and the pseudocode was provided. Here are the informations about it. Here are the steps: 1. In a single pass on the array, the algorithm finds …

Member Avatar for Momerath
0
103
Member Avatar for qqwushi12345

Solving the greatest common divisor using C++ and the Euclid method Below is my code: #include "stdafx.h" #include "genlib.h" #include "simpio.h" #include "math.h" int _tmain(int argc, _TCHAR* argv[]) { int num1,num2,rem; printf("Enter 1st number: "); num1=GetInteger(); printf("Enter 2nd number: "); num2=GetInteger(); rem=num1%num2; ;if(rem==0) { printf("The GCD of %d and %d …

Member Avatar for daviddoria
0
162
Member Avatar for intelfx

Hi there! I have a task - to compare 2 std::lists without taking elements order into account. That is, lists A-B-C-D and D-C-B-A are equal, but A-B-C-D and A-B-D-E aren't. We start with the following code [CODE] class T { ... public: bool operator= {...} } bool compare_lists(const std::list<T>& list_1, …

Member Avatar for intelfx
0
3K
Member Avatar for HKL-Jerry

Hey all, i am currently working on a system that detect the value input and carry out an action is the value is accepted but rests everything when the value is denied. i have an algorithm but i don't seem to be able to transfer it into coding. Start. Set …

Member Avatar for StuXYZ
0
149
Member Avatar for insanely_sane

EDIT: This was moved from the Java discussion forum. It seems more appropriate to post it here. This is not exactly a homework assignment. I'm just doing it for fun ^^ Hey guys. I am currently just a 11th grade student but since I'm done the whole curriculum for my …

Member Avatar for insanely_sane
0
203
Member Avatar for insanely_sane

Hey guys. I am currently just a 11th grade student but since I'm done the whole curriculum for my Computers class already, I recently just started making extra stuff for fun. One of things I'm doing is Making a graphical/visual sorting applet. Something like : [url]http://www.cs.ubc.ca/~harrison/Java/sorting-demo.html[/url] I have my code …

0
105
Member Avatar for r1409

hi all i have an assignment in which i have to use object-oriented programming to read from an input file(say: input.txt), use prim's algorithm and calculate the weight of a minimun spanning tree and then save the output to a file(output.txt). the problem with my code is that the program …

Member Avatar for daviddoria
0
626
Member Avatar for gsmoura

I really need help in some parts of my minesweeper code using Tkinter. I don´t have much experience in python and I am facing two major problems that I just can´t solve. The first one is that, as I generate buttons dynamically, they all have the same name and receive …

Member Avatar for strider1066
0
139
Member Avatar for Ja14

This is as much of a question about algorithm as it is about code. I’m training monkeys to input data into a keyboard in the form of a table. I have created a special keyboard with nothing on it but numbers 0 - 9, a period, tab key and a …

Member Avatar for Ja14
0
121
Member Avatar for Nepenthe

Hi, I have this task that I need to solve and am stuck.I would like some help on this please.I am fairly new to this,so not sure what I should do.....really appreciated if anyone could help me out [I]Question Write an Algorithm to calculate discounts.[/I] Bookstore is offering discounts to …

Member Avatar for ubi_ct83
0
178
Member Avatar for jpl1993

i'm pretty clueless about everything dealing with python. i need help creating a sorting algorithm that can sort names in a list alphabetically. and example code to help get me started would be much appreciated.

Member Avatar for lllllIllIlllI
0
136
Member Avatar for Techwriter10

[ATTACH=right]14831[/ATTACH]Two days ago, the Dow Jones Industrialized Average [URL="http://www.montrealgazette.com/business/probing+point+dive/3001581/story.html"]plunged almost 1000 points in a half hour[/URL]. That's almost 10 percent of the entire value of the market in 30 minutes. That's insane! What happened? Well, it turns out, it was a fairly simple technological trigger that caused the problem. Seems …

0
214
Member Avatar for John Linux

I am reading in data from a textfile, specified by command line args eg.. <app> inputfile outputfile I have not yet done any file output, yet have developed some code. What I'm aiming for is printing out the shortest route from one node to another in a graph. *The graph …

Member Avatar for John Linux
0
206
Member Avatar for Tvirusx1

I just can't seem to solve this. Heres what I want to do: I want my program to calculate movement, from one point to another. The function _updatepos is the main function, where I have troubles. It is supposed to, as the name says, update the position (posx and posy), …

Member Avatar for Tvirusx1
0
153
Member Avatar for corby

Hey guys/gals i need some help with finding the T(n) complexity of the following for nested loops [CODE] sum = 0 for i = 0 to n-1 do [INDENT]for j = 0 to (i^2) - 1 do[/INDENT] [INDENT][INDENT]for k = 0 to j - 1[/INDENT][/INDENT] [INDENT][INDENT][INDENT]sum = sum + 1[/INDENT][/INDENT][/INDENT] …

Member Avatar for corby
0
105
Member Avatar for teenybopper

I need to write a program, which shows the different combinations in which matrices can be multiplied. The output should look like below : When there are two matrices multiplied there is one combination (XX) When there are three matrices multiplied there are two combinations (X(XX)) ((XX)X) When there are …

Member Avatar for jwenting
0
88
Member Avatar for seven11

I need help in determining,using Big-O notation, the upper-bound for these two algorithms i wrote. They both do the same thing but are coded differently. They both look for all the prime numbers up to some limit, N. This first algorithm: [CODE] public static void algo1(){ primes = new int[n]; …

Member Avatar for Rashakil Fol
0
120
Member Avatar for warlock07

So here is the algorithm I am trying to design...i'm not sure it will make any sense. I have a sequence of n numbers(in ascending order). I have an another number 'x'. If i have 2 chances to compare x with a number greater than it but unlimited chances to …

Member Avatar for warlock07
0
184
Member Avatar for Slobodino

I need an algorithm for the following problem: There's a tree with N fruits each with its own weight w[i] and height h[i]. I can only reach a fruit if it's no taller than H inches. Also every time I pick a fruit, all the other fruits in the tree …

Member Avatar for craig_ka
0
128
Member Avatar for shar88

is there any sample of java topological sort algorithm based on minimal vertex method. I also need to implement the ADT graph using adjacency lists representations

Member Avatar for dsmush
0
108
Member Avatar for FlippA

Hi All, I am trying to create a GA to solve timetabling for exams, so far I have created a array of exams e.g. [2,3,5,4] means exam 2 is held at time slot 1 and exam 3 is at time slot 2. //This is the testChromosome.ChromosomeArray is the sample code. …

Member Avatar for FlippA
0
125
Member Avatar for ne0_komodo

Okay friends this is actually my school work. My teacher asked me to make a diamond asteriks. I just try and with my code [CODE] #include<iostream> using namespace std; int main() { char b='*'; for(int i=10;i>0;i--) { for(int j=0;j<i;j++) { cout<<" "; } for(int c=10;c>i;c--) { cout<<b; } for(int a=10;a>i;a--) …

Member Avatar for ne0_komodo
0
181
Member Avatar for Khazidhea

Hello, First of all, excuse my English =) Warning: wall of text\code. I must say I have some experience in Java and long forgotten C++, so right now I have some problems implementing the Huffman coding. The algorithm goes like this: I create an array of 255 elements to represent …

Member Avatar for Khazidhea
0
233
Member Avatar for corby

ok so if T(1) = 3 and T(n) = T(n-1) +2n -3, n > 1 how do i solve for T(n) and how do i then prove it with the verification, inductive hypothesis, and inductive step? same thing for T(1) = 1 T(n) = T(n/2) + bn(logn) where b is …

0
70
Member Avatar for corby

Here some psuedocode for an algorithm: [CODE] function Fact(n) if n <=1 then return(1) else return (n * Fact(n-1)! end-if end-fact[/CODE] Now how do i find the recurrence equation for the program? Any help or hint would be appreciated!

Member Avatar for galagatron
0
87

The End.