Showing results 1 to 40 of 86
Search took 0.01 seconds.
Posts Made By: gregorynoob
Forum: C++ Oct 28th, 2008
Replies: 8
Views: 304
Posted By gregorynoob
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
Posted By gregorynoob
Re: This code ok or should i do diffo way?

depends on what it's supposed to do :)
Forum: C++ Oct 27th, 2008
Replies: 3
Views: 110
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
files..and stuff..and comparing...and compiling..ohh

okay, so i came up with this idea of making a program to evaluate my code. it's supposed to take the code, compile it, run it on several test cases (given in one file each) and report how the code...
Forum: C++ Oct 15th, 2008
Replies: 5
Views: 154
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
Re: How to use typedef for the template structure? What its syntax?

umm, sorry if it was not understandable, i tried to come up with a very long name for a type i want to define... so i made the name myself, don't try it it won't work. unless you define such a class....
Forum: C++ Oct 10th, 2008
Replies: 17
Views: 505
Posted By gregorynoob
Re: number of ways to..ehh, i hate counting ways

do you think the same thing when discussing algorithms with O(2^n) time complexity? poor tin cans would struggle for centuries if n was...say 100.
Forum: C++ Oct 10th, 2008
Replies: 19
Views: 570
Posted By gregorynoob
Re: Question about a simple sorting method without arrays

you can access them by memory addresses... so the integers should be given addresses that are consecutive. could count as pointing really.
Forum: C++ Oct 10th, 2008
Replies: 12
Views: 454
Posted By gregorynoob
Re: How to use typedef for the template structure? What its syntax?

yea, you gotta either macro it or typedef with specifying the actual template type :P sucks in a way... but hey, what's the deal with the box thing, it's pretty small and easy to write...
i use...
Forum: C++ Oct 10th, 2008
Replies: 17
Views: 505
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
Re: number of ways to..ehh, i hate counting ways

lol, i get it now finally... i thought i'm supposed to go from the largest coin down every time...that would be just sick.
Forum: C++ Oct 8th, 2008
Replies: 17
Views: 505
Posted By gregorynoob
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
Posted By gregorynoob
Re: number of ways to..ehh, i hate counting ways

hmmm, could i please get a more detailed explanation?
Forum: C++ Oct 8th, 2008
Replies: 17
Views: 505
Posted By gregorynoob
Re: number of ways to..ehh, i hate counting ways

hmm, yeah, but how can it be done in some reasonable time?
Forum: C++ Oct 8th, 2008
Replies: 17
Views: 505
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
Re: number rotation game :)

@WaltP
umm, dfs? how do you mean dfs, what you mentioned seems like trying all possibilities...
Forum: C++ Oct 6th, 2008
Replies: 8
Views: 343
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
Re: How do I fix this, is this a whitespace error? Help!

well... i'm not that good with c++ I/O (c ftw), but if you're using fstream, you can make two streams and use them for I/O, for example if the input stream is called 'input' you can go with while(...
Forum: C++ Oct 2nd, 2008
Replies: 12
Views: 519
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
Re: rounding function with precision

nah, math only gives full rounding, not precision.
Forum: C++ Sep 30th, 2008
Replies: 4
Views: 549
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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
Posted By gregorynoob
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...
Showing results 1 to 40 of 86

 
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:31 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC