Forum: C++ Oct 28th, 2008 |
| Replies: 8 Views: 304 Re: Pointer / Linked list question ehh, now i'm confused... it would be helpful to see some code you've done already, but this is my suggestion: don't use a stack. it's a maze... a pretty straightforward graph. if you know where you... |
Forum: C++ Oct 27th, 2008 |
| Replies: 3 Views: 133 |
Forum: C++ Oct 27th, 2008 |
| Replies: 3 Views: 110 Re: Test Casing hmm, define test case...? i don't get it... you can write some numbers onto a piece of paper, add them up and divide by the their quantity... enter those numbers into your program and check if the... |
Forum: C++ Oct 23rd, 2008 |
| Replies: 11 Views: 374 Re: plane sweepin you're assuming too much, nobody guarantees any of those cases you mentioned. x1 < x2? why? it can be the opposite! also.. it isn't true that union is the area of the overlap.. it's the total area... |
Forum: C++ Oct 22nd, 2008 |
| Replies: 11 Views: 374 Re: plane sweepin hmm, union of n rectangles, each defined by only two points, the segments are parallel with the lines of the system (x and y). |
Forum: C++ Oct 22nd, 2008 |
| Replies: 11 Views: 374 Re: plane sweepin okay, so i've tried...hard, seriously. and i'm stuck. i've implemented the events, and an imaginary set to hold them in, but i'm stuck at the actual sweeping part. the problem i'm trying to solve is... |
Forum: C++ Oct 20th, 2008 |
| Replies: 11 Views: 374 Re: plane sweepin i would, but i'm really not talented in implementing something from scratch, my first mergesort took 10 secs to sort 100 integers, and even then, they weren't sorted. with msort it was easy cause i... |
Forum: C++ Oct 20th, 2008 |
| Replies: 11 Views: 374 plane sweepin heya... ok, so i was browsing the net to find out if there's a good text on this algorithm, but i don't seem to be able to find one. people are obviously using it, but, hey, there's no info on... |
Forum: C++ Oct 18th, 2008 |
| Replies: 2 Views: 104 |
Forum: C++ Oct 15th, 2008 |
| Replies: 5 Views: 154 Re: more counting :( but i need the minimum...that's not the minimum...try for example with dimensions 6*7... |
Forum: C++ Oct 15th, 2008 |
| Replies: 5 Views: 154 more counting :( okay...i've got another wired counting problem, this time it's about rectangles!
gotta find the minimum number of lines to divide a rectangle into squares! i went for...ehh
well a dumb idea of... |
Forum: C++ Oct 10th, 2008 |
| Replies: 12 Views: 454 |
Forum: C++ Oct 10th, 2008 |
| Replies: 17 Views: 505 |
Forum: C++ Oct 10th, 2008 |
| Replies: 19 Views: 570 |
Forum: C++ Oct 10th, 2008 |
| Replies: 12 Views: 454 |
Forum: C++ Oct 10th, 2008 |
| Replies: 17 Views: 505 Re: number of ways to..ehh, i hate counting ways hehe, i'm lazy too, but i still wanna speed it up. found another way, without recursion, the idea is: no need to check for 1's, they always give 1, and 2's always give ( n/2 )+1...
still too slow :( |
Forum: C++ Oct 10th, 2008 |
| Replies: 17 Views: 505 Re: number of ways to..ehh, i hate counting ways hmm, okay...that's fast... reps to you!
//edit
umm it's not that fast, i see now, mine is alot faster, you haven't optimized the recursion, so you're making calls that aren't needed... mine goes fast... |
Forum: C++ Oct 9th, 2008 |
| Replies: 17 Views: 505 Re: number of ways to..ehh, i hate counting ways hmm, well now i've implemented it, but it's so damn slow... it should work fast for 100k atleast... here's my implementation:
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MOD... |
Forum: C++ Oct 9th, 2008 |
| Replies: 17 Views: 505 |
Forum: C++ Oct 8th, 2008 |
| Replies: 17 Views: 505 Re: number of ways to..ehh, i hate counting ways i mean, for example 3 has 2 solutions: 1+1+1 and 2+1, so if i go your way, i'll first take 2 off of the once and run the recursion on 3-2=1
which will give 1 solution. then i'll go down to 1, and run... |
Forum: C++ Oct 8th, 2008 |
| Replies: 17 Views: 505 |
Forum: C++ Oct 8th, 2008 |
| Replies: 17 Views: 505 |
Forum: C++ Oct 8th, 2008 |
| Replies: 17 Views: 505 number of ways to..ehh, i hate counting ways okay, this is the problem (variation of the knapsack coins problem): you've got 4 coin types:
1 cent, 2 cents, 5 cents and a quarter...infinite amount of each. I'm supposed to find the number of ways... |
Forum: C++ Oct 7th, 2008 |
| Replies: 8 Views: 343 Re: number rotation game :) hmm, but is there a way to shorten it, i got the concept of doing it recursively, but all i need is a limit for the number so i don't overflow the stack, also, is there a way to cut it on time by... |
Forum: C++ Oct 7th, 2008 |
| Replies: 8 Views: 343 |
Forum: C++ Oct 6th, 2008 |
| Replies: 8 Views: 343 Re: number rotation game :) it's about having a board with 9 numbers, 1-9 obviously. they are organized in a 3*3 matrix.
the solved problem looks like:
123
456
789
the problem is, you are given a scrambled matrix, and you have... |
Forum: C++ Oct 6th, 2008 |
| Replies: 12 Views: 519 Re: factoring binomials i still don't really get it... if the input is in shape of (ax+b)(cx+d) you can easily solve this to acx^2+x(ad+bc)+bd, which you can simply extract from your string looking at them as being just... |
Forum: C++ Oct 6th, 2008 |
| Replies: 8 Views: 343 number rotation game :) okay, i don't have a problem coding the game... that part would be easy. but the problem is to output the lease number of rotations needed to complete the game, so for example...
123 => 413
456 =>... |
Forum: C++ Oct 2nd, 2008 |
| Replies: 5 Views: 209 |
Forum: C++ Oct 2nd, 2008 |
| Replies: 12 Views: 519 Re: factoring binomials if you could post a more detailed description of the problem... if you're only working with square binomials it should be really simple.
for example, if the shape of the input is
ax^2 + bx + c, all... |
Forum: C++ Sep 30th, 2008 |
| Replies: 5 Views: 297 Re: extract numbers from char well if you know the exact position of those chars you can easily extract them from the string you read them in... for example, the given the position and length of the integer, you could go with... |
Forum: C++ Sep 30th, 2008 |
| Replies: 35 Views: 1,396 Re: finding prime numbers well this is a simple implementation of the sieve... #include <cstdio>
#define MAX 100000
bool prime[ MAX ];
void sieve() {
for( int i = 0; i < MAX; ++i ) prime[i] = 1;
prime[1] = 0;
... |
Forum: C++ Sep 30th, 2008 |
| Replies: 4 Views: 396 Re: Reversing a string using stack also can be done recursively..but stack almost equals recursion... for example:
#include <iostream>
#include <string>
using namespace std;
void do_the_stuff() {
char c; c = getchar();
if(... |
Forum: C++ Sep 30th, 2008 |
| Replies: 4 Views: 549 |
Forum: C++ Sep 30th, 2008 |
| Replies: 4 Views: 549 rounding function with precision every time i make my own rounding routine with precision, i see my compiler suggesting a function long double round(long double x, int precision); so i was wondering if someone knows what library it... |
Forum: Troubleshooting Dead Machines Sep 28th, 2008 |
| Replies: 2 Views: 267 Re: Graphics card output problem also, the motherboard leds aren't lighting, which indicates abnormal cpu or chipset error, well atleast it says so in the manual... |
Forum: Troubleshooting Dead Machines Sep 28th, 2008 |
| Replies: 2 Views: 267 Graphics card output problem i got myself a big pile of components yesterday, an amd dual core procesor, a new motherboard (biostar ta770 a2+) and a new graphics card, nvidia(club3d geforce 9600gt overlocked). so now i've put it... |
Forum: C++ Sep 27th, 2008 |
| Replies: 6 Views: 391 Re: wired knapsack... well i guess it can really be done without DP, as it is not really limited and can be done by going through the sorted array of items from the end to the start, if an item is larger than limit, limit... |
Forum: C++ Sep 27th, 2008 |
| Replies: 6 Views: 391 Re: wired knapsack... a simple loop? could you please tell me what algorithm would that be? cause recursion would go O(n!), would have to check all the combinations, also i didn't say, there are no unlimited supplies of... |
Forum: C++ Sep 27th, 2008 |
| Replies: 6 Views: 391 wired knapsack... ok, so this is my problem...
i have an array of items, which i want to sum to x or above in a most efficient way...
is there a way for doing this? cause all the values are 64 bit ints.
i tried... |