Search:

Type: Posts; User: mkruk

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    58
    Views
    7,775

    you're forgetting that we're allowed to have just...

    you're forgetting that we're allowed to have just one recursion. if we've computed the sum, we have no recursion left to traverse the array. So theres got to be another solution.

    but no matter...
  2. Replies
    92
    Views
    18,216

    I copyed and pasted your code and compiled it as...

    I copyed and pasted your code and compiled it as it is shown. And it returns 5.


    mk@mk:~$ cat test.c
    #include <stdio.h>
    int max_seq(int *arr, int i, int last, int len);
    int main()
    {
    ...
  3. Replies
    58
    Views
    7,775

    my first idea is to get the sum and divide it by...

    my first idea is to get the sum and divide it by 2. now we have the sum for both partitions.
    Then I'd traverse the array and check if I can substract elements until I get zero.
  4. Replies
    92
    Views
    18,216

    nah. you have written two functions and the first...

    nah. you have written two functions and the first one calls the second. If I understand that condition correctly, then the task was to have only a single function which calls itself.

    edit: damn,...
  5. Replies
    92
    Views
    18,216

    you're using one of those :p anyway, I don't...

    you're using one of those :p

    anyway, I don't think its possible to make the function any shorter than 5 lines without making the code unreadable
  6. Replies
    92
    Views
    18,216

    you're welcome :) I've had quite some fun...

    you're welcome :)

    I've had quite some fun thinkin about how to make the solution as short as possible. I'm a minimalist
  7. Replies
    92
    Views
    18,216

    duh.. because you can just put 8 numbers into an...

    duh.. because you can just put 8 numbers into an array of size 9


    #include <stdio.h>

    int max_seq(int *arr, int i, int last, int len)
    {
    if(i > len)
    return(0);
    int eval = (i == 0 ?...
  8. Replies
    92
    Views
    18,216

    its actually very simple.. for every cell you...

    its actually very simple.. for every cell you check
    a) if theres a bigger sequence starting at the next cell
    b) if that sequence is bigger than the sequence starting at this very cell

    if we're...
  9. Replies
    92
    Views
    18,216

    oh god you can't be serious :D I tried to...

    oh god you can't be serious :D

    I tried to implement it and it isnt very difficult. My implementation is all recursive, exactly as you require it to be and its just 5 lines of code (not counting...
  10. Replies
    1
    Views
    3,003

    in the first place, I'd check with lsof if some...

    in the first place, I'd check with lsof if some process locks the file "/afs/ir/users/l/i/lizb1/.iCE authority."
    the next step would be checking the permissions of the directory and the file. If the...
  11. Replies
    9
    Views
    5,392

    as already pointed out, the problem is in line 1...

    as already pointed out, the problem is in line 1 of your main() function. What you have there is actually a multidimensional array, which conflicts with your declaration of the readLine() function. ...
  12. Replies
    2
    Views
    2,234

    how did you code the delay? are you sure it...

    how did you code the delay? are you sure it delays by one second?
    if it does, how do you establish the connections? is there something else writing to the sockets?

    like matsp mentioned, I'd be...
  13. Replies
    3
    Views
    6,064

    INADDR_ANY is not supposed to be a remote...

    INADDR_ANY is not supposed to be a remote destination; its for listening sockets. using it on a client socket has the same effect like using 127.0.0.1, but has the side effect of making your code...
  14. Replies
    37
    Views
    10,848

    sounds like a fairy tale to me... the Arctic...

    sounds like a fairy tale to me...


    the Arctic isn't USA. You were talking about US oil reserves.
    Still, drilling in the Arctic could be difficult because of the temperatures. And isn't there a...
  15. Replies
    37
    Views
    10,848

    no, I was saying that the USA using their own oil...

    no, I was saying that the USA using their own oil is nonsense. With increasing demand for cars this might actually be 2 years or less.

    I totally agree that, on the long run, oil is not a reliable...
  16. Replies
    37
    Views
    10,848

    I doubt that. As a little proof, let's look at...

    I doubt that.

    As a little proof, let's look at some statistics from wikipedia:
    According to this, USA produces 8.481.000 barrels of crude oil per day (yes, crude oil.. so the amount of usable...
  17. As far as I know, the whole EU is planning to do...

    As far as I know, the whole EU is planning to do this. Well, actually not monitoring like looking what exactly someone is transfering, but logging what IPs are being connected and the amount of data...
  18. Replies
    3
    Views
    2,244

    close(new); has to be in the while loop,...

    close(new); has to be in the while loop, otherwise new will be assigned a new socket, but the old one will not be closed, thus creating more and more sockets.
    this is also the problem why a client...
  19. Thread: HTML as GUI

    by mkruk
    Replies
    8
    Views
    11,038

    the easiest method is writing a webserver for...

    the easiest method is writing a webserver for that specific html page, which shouldn't be a big deal if you're familiar with html. The difficult part is, that you'll need a good understanding of the...
  20. Replies
    8
    Views
    4,973

    I think there's no such function or format...

    I think there's no such function or format string. Write a loop that prints one digit after another. A little hint, modulo is needed here. When dividing the number with 10, the remainder is the last...
  21. Replies
    8
    Views
    14,513

    I doubt this works. This will read two messages...

    I doubt this works. This will read two messages and discard the first one. Later on, this will definitely lead to unwanted behaviour
  22. Replies
    8
    Views
    14,513

    either strcmp() or loop through the string. I...

    either strcmp() or loop through the string. I don't think there's another way.
    And I'd prefer the latter one, if you want to filter strings like " ", " ", etc.
  23. Replies
    141
    Views
    37,483

    Even if some of them get slaughtered, they can...

    Even if some of them get slaughtered, they can still prevail. Look at the Bolsheviki or Ghandi
  24. Replies
    141
    Views
    37,483

    Civil disobedience is not the answer imo. Well,...

    Civil disobedience is not the answer imo. Well, unless a lot of people do it.
    but if not, this is just as useless as demonstrating agains carnivores or the iraq war - it just happens. (Don't get me...
  25. Thread: biggest program

    by mkruk
    Replies
    14
    Views
    9,384

    The Gimp is written in C. So is Linux (except for...

    The Gimp is written in C. So is Linux (except for some assembly files).
    As far as I know, OpenOffice is Java, hence the JRE installation when installing OpenOffice.

    I'm not sure about FireFox, it...
Results 1 to 25 of 64
Page 1 of 3 1 2 3