Search found 286 matches

by sumankar
Thu Jan 19, 2006 12:58 pm
Forum: C++
Topic: Is STL set a binary search tree?
Replies: 9
Views: 6205

A balanced binary tree is more likely. A binary search tree has a worst case performance no
better than a linked list. Look up red-black trees, AVL etc.
by sumankar
Wed Jan 11, 2006 4:27 pm
Forum: C++
Topic: About virtual
Replies: 2
Views: 1474

Re: About virtual

I'm C programmer and I want to know about C++ language features. Can someone explain to me in clear and easy-to-understand language about these: Welcome aboard! Caveat: C and C++ are different languages. a. Can constructor declare using virtual? If yes, what does it mean? Short answer no. It can be...
by sumankar
Mon Jan 09, 2006 10:42 am
Forum: C++
Topic: stdio or iostream??
Replies: 6
Views: 2754

The C style io routines work better at times, or so I have seen. I doubt though, if it can be
generalized. Depends on the percentage of runtime you spend on IO, I believe.
by sumankar
Tue Oct 11, 2005 5:47 am
Forum: Volume 109 (10900-10999)
Topic: 10926 - How Many Dependencies?
Replies: 33
Views: 14489

1. There already are threads relating to this problem, check them out.
2. I used Floyd-Warshall, my favourite, though there are a host of other
possible alternatives. And it was slow. But it works ;)
by sumankar
Fri Sep 30, 2005 6:27 am
Forum: C++
Topic: sorting list
Replies: 2
Views: 1786

In order for sort to work overload the '<' operator.
Maybe...

Code: Select all

bool operator<(list<int>::iterator a, list<int>::iterator b)
{
       return (*a > *b);
}
...
//call it like 
l.sort()
...
by sumankar
Tue Sep 13, 2005 8:27 am
Forum: C++
Topic: Character in string
Replies: 1
Views: 1363

Isn' there something called length() for std::string?
by sumankar
Tue Sep 13, 2005 8:25 am
Forum: Volume 107 (10700-10799)
Topic: 10719 - Quotient Polynomial
Replies: 51
Views: 17471

K&R has something called getword() function. Implementing a getnum() on similar lines is trivial. You've not mentioned the type of numeric data you want to proceed, the kind of complexity you wish to delve in etc. And these can affect your input scanning routine quite a bit. One example might've hel...
by sumankar
Fri Sep 09, 2005 2:37 pm
Forum: Volume 100 (10000-10099)
Topic: 10068 - The Treasure Hunt
Replies: 31
Views: 6340

1. This is not the right place.
2. Don't ever ask someone to send his solution to him.
(Because sending you the solution won't be helping you.)
by sumankar
Wed Aug 24, 2005 11:04 am
Forum: Volume 5 (500-599)
Topic: 537 - Artificial Intelligence?
Replies: 76
Views: 11318

Re: judge says compile error, but I'm sure it works.

[snip] #include <iostream> #include <stdlib.h> #include <iomanip> using namespace std; void readVal(int); //reads converts, and stores numbers into p,u, or i. void calculate(); //calculates the missing variable and outputs to screen float p, u, i; char used[2]; //2 characters to indicate the variab...
by sumankar
Wed Aug 24, 2005 11:00 am
Forum: Volume 5 (500-599)
Topic: 537 - Artificial Intelligence?
Replies: 76
Views: 11318

[snip] 2. you don't set all options of compiler (I heard about something like gcc -wall -strict -ansi file.c to compile - check options of your compiler). Hey Dominik, Its -Wall ;) Also a few more things I'd like to add to your excellent suggestions: + if using gcc, use .c[c|p|xx|pp|PP|++|C] as the...
by sumankar
Wed Aug 24, 2005 10:46 am
Forum: Volume 108 (10800-10899)
Topic: 10814 - Simplifying Fractions
Replies: 30
Views: 16801

I had a similar problem, I was sure of the BigInt part, but still got TLE. And that is when it struck me to tune my input scanning part. I haven't looked at your BigInt class, call me lazy, if you will! But the input scanning part -- I did have a look and I do think you need to change it. It ain't t...
by sumankar
Tue Aug 16, 2005 6:28 am
Forum: Volume 102 (10200-10299)
Topic: 10259 - Hippity Hopscotch
Replies: 15
Views: 3366

This is C++, not C, so int is no longer the default type. main should return int. Even in C, main must return an int value. However, the default to int rule is not applicable here, as the OP uses void main(), which is not supposed to be a standard return type for int. Some implementations might sup...
by sumankar
Tue Aug 16, 2005 6:19 am
Forum: C
Topic: Take integer after gets()
Replies: 2
Views: 2117

Why are you using gets() at all? Try a combination of fgets and sscanf or
fscanf. And of course, the power of conversion specifiers!
by sumankar
Wed Aug 10, 2005 6:08 am
Forum: Volume 105 (10500-10599)
Topic: 10597 - Right Words
Replies: 4
Views: 2534

Thanks a lot, Abednego. I left the problem unsolved a long time back,
and maybe, its time to go start all over again!
Regards,
Suman.
by sumankar
Mon Aug 01, 2005 6:19 am
Forum: C
Topic: Passing variable number of arguments to functions..
Replies: 6
Views: 6484

As for functions that _pretend_ to have variable number of arguments (like main), AFAIK, main() has no _pretensions_ whatsoever! The C Standard(C99) defines two prototypes for main, viz. int main(void) int main(int argc, char *argv[]) Of course, a conforming implementation could support others, but...

Go to advanced search