« first day (685 days earlier)      last day (2174 days later) » 

12:32 AM
0
Q: Error ! null list

YODAI have a problem, my code is executing option 3 only the first time, if I go back to the menu and try again appears nulla. Case 3 is to list a list of names in alphabetical alphabetical order and reverse order (InsertOrd 0 / InsertDec 1); Here is the code: #include <stdio.h> #include <stdlib.h>...

 
 
2 hours later…
2:10 AM
Hallo
I'm attempting this... https://projecteuler.net/problem=8

https://hastebin.com/wamuhejalu.cpp
And that is my code. It seems to work for the test case they gave us. But gives a stupid large number when I try it with 13 digits.
Oh
I fixed it.
Just string had error.
 
 
3 hours later…
5:39 AM
@Annabelle long is not sufficient, better use long long.
13 digits we are talking about.
 
 
10 hours later…
3:19 PM
hello
 
@YODA Hello
 
@JerryCoffin How are you?
What is the practical usefulness of Doubly linked list?
 
@YODA In my experience, linked lists (in general) have little practical use.
96
Q: Under what circumstances are linked lists useful?

Jerry CoffinMost times I see people try to use linked lists, it seems to me like a poor (or very poor) choice. Perhaps it would be useful to explore the circumstances under which a linked list is or is not a good choice of data structure. Ideally, answers would expound on the criteria to use in selecting a ...

 
@JerryCoffin If you had to do an ordered string insert how would you do? I have an example of a simple one, but when trying to write in reverse order I can not. Maybe my biggest problem is the prev pointer.
struct Lista *InsertOrd(struct Lista *head, const char *data) {
    struct Lista *newp;
    struct Lista *tmp;
    char *new_data;

    /* aloca o novo item */
    newp = ((struct Lista*)malloc(sizeof(struct Lista)));
    new_data = strdup(data);
    //strdup aloca memória na pilha.
    if (newp == NULL || new_data == NULL) {
        fprintf(stderr, "out of memory");
        return NULL;
    }
    newp->data = new_data;
    newp->next = NULL;

    /* check if element should be inserted at the head */
 
@YODA Is there real requirement that it use a linked list? My immediate reaction would be to use something like std::multiset.
 
3:30 PM
what is std::multiset ? @JerryCoffin
 
You just need to list the names. But the problem is that these names are getting a txt file.
 
@YODA You mean you're filling the list with data from the text file?
 
Yes
Strings
@JerryCoffin
 
@YODA So is each string a word or a whole line, or what?
 
user7909000
3:33 PM
Did the problem you presented yesterday was resolved?
 
just a word @JerryCoffin
 
@YODA And you're doing this in C++, not C?
 
@Revolver Not very well, I'm trying to implement a double linked list.
@JerryCoffin C
 
@YODA Yish.
 
The syntax is similar so I thought I could ask the question in this room. @JerryCoffin
Sorry
 
user7909000
3:37 PM
Both are nearly same except for the OOP cpp had introduced.
 
@YODA You probably can. I don't particularly mind (and even if I did, it wouldn't matter). Not something I want to participate directly in though...
 
Is there a C room?
 
user7909000
I am deactivating this my account.
 
@Revolver why?
 
@YODA Not that I know of. The discussion probably fits here more than it does anywhere else.
 
3:41 PM

C

C stands for Control.
 
@milleniumbug thank you my friend!
 
user7909000
@YODA I am banned from asking any more questions and I am required to make edits on my questions for better response which is not helping.
 
@Revolver ask you question in stackoverflow PT BR or stack spanish
 
user7909000
3:53 PM
Why?
 
4:06 PM
no necessary remove your acount ? @Revolver
 
 
1 hour later…
5:35 PM
i'm curious to know if the c++ going in the teams is somehow superior to that in the classic main.
 
 
2 hours later…
7:18 PM
So I'm trying to solve: https://projecteuler.net/problem=14

And this code works pretty much fine upto 100k something. But after a certain point it just randomly hangs and stops running. Is there something wrong?

https://hastebin.com/hokedumatu.cpp
 
you are trying to (just about) brute force a project euler problem
 
Well that's why I have the std::map
To cache the previous iterations
That code works fine
But this one when I use 1mil
instead
 
> But after a certain point it just randomly hangs and stops running
how do you determine it stops running
(and not that, for example, it just takes very long to run)
 
I used a cout during the loop
std::cout << i << "\n"
 
which one
 
7:28 PM
And it stops around 130k or so
the one in int main()
It also hangs for example
if I run from 950k to 1mil, it hangs around 953k
or so
 
and if you put a cout on the loop in termCount (that outputs every 1000 terms)?
 
Okay I think I got it
Now to figure out why it's giving incorrect output..
 
it's probably overflowing
 
7:44 PM
Nah I think it's the map/cache
hmm doesn't work with a vector either.
Oh
I see.
 

« first day (685 days earlier)      last day (2174 days later) »