Search:

Type: Posts; User: kolistivra

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    1,851

    finding a position in stl map

    hi,

    i am looking for a function in STL that does this job:

    say, i have a map with elements a,b,d,e, and their values are 10,20, 30,40 respectively.

    i want a method, that gives me 20(or the...
  2. A pointer problem from a high school programming contest

    Hi experts,

    The code below is from a programming contest, the answer must be given without using a compiler(this test is on paper).


    The problem: How many '*' does that piece of code prints?...
  3. Replies
    16
    Views
    5,099

    the main problem of mine was that, i put the...

    the main problem of mine was that, i put the items in the set, and the way i put sorted the items according to their node number, instead of the cost. some little modifications corrected the code....
  4. Replies
    16
    Views
    5,099

    I had an error in my STL! The problem was my...

    I had an error in my STL! The problem was my mistake! now the runtimes are:

    STL: 0.047
    Heap: 0.031

    I inserted the the items in the Set in a wrong way, that's why the runtime difference was...
  5. Replies
    16
    Views
    5,099

    Yes, both give the same and the right result. The...

    Yes, both give the same and the right result. The bubbling thing is doing heap's job, I guess.

    After your post, I compiled with -O3 parameter, but the runtimes didn't change much.(~0.01 seconds...
  6. Replies
    16
    Views
    5,099

    Well, here we go: the input generator: ...

    Well, here we go:

    the input generator:



    #include <cstdio>
    #include <cstdlib>
    #include <ctime>
    using namespace std;
  7. Replies
    16
    Views
    5,099

    Well, my new tests showed me an unbeliveable...

    Well, my new tests showed me an unbeliveable difference. in this test, i didn't count the IO(reading vertex and edge information from ~3mb file)

    in the best performances:

    STL Set version: 0.687...
  8. Replies
    16
    Views
    5,099

    Well, it did indeed increase the performance by...

    Well, it did indeed increase the performance by about ~%7-8. thanks. do you have any other suggestions?
  9. Thanks!

    Thanks!
  10. Replies
    16
    Views
    5,099

    Array of Vectors amd other STL questions

    Hi,

    I'm experimenting to code dijkstra with STL. The STL version of the algorithm runs slower than the hand-written heap, expectedly.

    Even though STL one probably will never work as fast as...
  11. invalid types 'int[int]' for array subscript

    Hi,

    I'm trying to code Dijkstra by using STL, but I keep getting this error. I must be missing but I can't find it, here is the code:



    #include <iostream>
    #include <cstdio>
    #include <set>...
  12. Replies
    11
    Views
    9,762

    @quzah: i wrote my code according to the...

    @quzah: i wrote my code according to the suggestions of dwks,i think you didnt see it, and why im here is because im stuck at understanding and solving the question.

    guys, i think my understanding...
  13. Replies
    11
    Views
    9,762

    10 / \ 5 15 / \ ...

    10
    / \
    5 15
    / \ / \
    3 7 13 17

    try your code on this. it will give 7, whereas it must give 8...
  14. Replies
    11
    Views
    9,762

    i have coded something like that: int...

    i have coded something like that:


    int epl(node *tree) {
    if (tree==NULL) return 1;
    else return epl(tree->left) + epl(tree->right) ;
    }

    but this gives 7 for the tree below,whereas it must...
  15. Replies
    11
    Views
    9,762

    Determining external path length of a tree

    Hi,

    I'm studying algorithms from the book "Algorithms in C" by Sedgewick and I have encountered with a question that I couldn't solve. The problem is to create a function to determine the external...
  16. Replies
    9
    Views
    17,448

    nope, i don't wanna get into any hairy stuff, im...

    nope, i don't wanna get into any hairy stuff, im just looking for the fastest safe method possible, which can possibly be, in this context, looping through each element and memset, i agree with you...
  17. Replies
    9
    Views
    17,448

    yeah that is exactly what i'm looking for,...

    yeah that is exactly what i'm looking for, another method, but as you say, is that faster? anyone knows about the performance of memset over going over all elements?

    thanks
  18. Replies
    9
    Views
    17,448

    Setting all elements of an array to zero

    Hi,

    int a[1000] = { 0 };

    this initializes all elements of the array a to 0. let's say i have changed some elements, and now want to set all items to 0 again. should i go through all elements...
  19. Replies
    3
    Views
    1,457

    sorry that i didn't look at it, ty for answers..

    sorry that i didn't look at it, ty for answers..
  20. Replies
    3
    Views
    1,457

    Impact of void on prototype

    hi, what is the difference between these?


    int abc() {
    ...
    }

    int abc(void) {
    ...
    }
  21. Replies
    1
    Views
    1,242

    Value of structure can't be changed

    Hi, I have encountered with a bizarre problem. Though i solved it in a different way, i can't understand why the problem occurs.

    Here is the problematic code:



    #include <stdio.h>
    #include...
  22. Ok, but isn't the issue a bit different for...

    Ok, but isn't the issue a bit different for arrays? AFAIK, arrays are passed by reference, unlike other data types. So, shouldn't their actual values change? If you can clarify this point a little...
  23. Thank you ZuK, it seems to be working fine now,...

    Thank you ZuK, it seems to be working fine now, with your suggestion as well as another bug i have found

    Thank you again.
  24. well, you are right itsme86, the correct answer...

    well, you are right itsme86, the correct answer is d(btw, i forgot to put space there, there is one)

    what i couldn't get is that, you say the function has no effect on main, but



    p = a;
    q =...
  25. a high school programming question and an issue about an error

    Hi,

    I've some problems to get over, first of all, i keep getting this error and couldn't get it solved. here is the code and the error i get:

    the error: error C2664: 'strtok' : cannot convert...
Results 1 to 25 of 25