Search:

Type: Posts; User: budala

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Print all nodes of the same level from binary tree

    This is the scenario:

    1. user inputs an int N for the desired level
    2. if N is greater than the total number of levels in the tree, repeat input
    3. if N is less than 0, repeat input
    4. if N is...
  2. Replies
    6
    Views
    9,178

    I'm sorry but I can't build a matrix with a large...

    I'm sorry but I can't build a matrix with a large enough number of rows, because the rows should grow dynamically :(
  3. Replies
    6
    Views
    9,178

    how do i insert a row into a matrix?

    I start with a matrix which has 10 columns and just one row, and I would like to add a seccond row below that one if the elements in the first row satisfy a certain property, add a third if the...
  4. got it!

    got it!
  5. I think I didn't make my self clear. When I said...

    I think I didn't make my self clear. When I said "end" i thought "after the last node in the list" or more precisely "before the beginning in the list"
  6. add to the beginning of a circular (singly) linked list

    Hi there. Long time no read :)

    I have a problem with my circular list. I can add a node to the end of the list just fine, but I can't seem to add it to the beginning.

    This is (sort of a...
  7. Replies
    8
    Views
    1,968

    dang nabbit :D

    dang nabbit :D
  8. Replies
    8
    Views
    1,968

    yes i did read it and thats what led me to...

    yes i did read it and thats what led me to believe that instead of remembering to free everything I could use alloca
  9. Replies
    8
    Views
    1,968

    @Salem - did I then misunderstand the purpose of...

    @Salem - did I then misunderstand the purpose of alloca? Is it not suppose to do the allocating and freeing of memory instead of ... Me? :D
  10. Replies
    8
    Views
    1,968

    When I input name: "abc", age: "20", id: "1" the...

    When I input name: "abc", age: "20", id: "1" the printout function returns this to the screen

    NAME: ????!?!? AGE: 1832928 ID: 29382235
  11. Replies
    8
    Views
    1,968

    alloca() function

    I would like to dynamically allocate memory for nodes in a linked list. I used to use malloc() and free() afterwards, but heard lately that it's simpler (with certain limitations like running out of...
  12. Replies
    3
    Views
    1,146

    I would like to avoid hashing. Not that I'm...

    I would like to avoid hashing. Not that I'm affraid of it, just want to do it the "normal" way using only that one linked list ;)
  13. Replies
    3
    Views
    1,146

    Mass deletion from linked list

    How would one go about deleting every single person (node) from a singly linked list which has the name Jack?

    i.e.

    Start:


    Jack -> John -> Ann -> Bill -> Jack -> Jack -> Frank -> Jack
    ...
  14. Replies
    9
    Views
    13,215

    that's exactly that! I figured out that my logic...

    that's exactly that! I figured out that my logic is flawed in that respect ;)
  15. Replies
    9
    Views
    13,215

    That's what happens when you replace with...

    That's what happens when you replace with copy/paste, and then add some more code whilst forgetting to replace it also :D

    Anyways, replaced the idioms in my native language with english ones, and...
  16. Replies
    9
    Views
    13,215

    Sort linked list by pointer manipulation

    Hi there, long time no bother :D

    I am trying to sort a singly linked list using pointer manipulation using a "selection sort"-ish algorithm and I'm having problems.

    My idea is this:

    1....
  17. solved it. trivial really but not a couple of...

    solved it. trivial really but not a couple of hours ago :D

    one simply needs to keep track of the element from which we are using the desired field for comparison. I called it element x :D


    int...
  18. Insertion sort - sort an array of structs using a single field

    I have an array of structs
    typedef struct node
    {
    int a,b,c,d;
    } element;

    ...

    element array[5];
  19. Replies
    1
    Views
    2,127

    bubble sort directional problems

    I want to sort an array using bubble sort. I know it's the slowest but i have only 5-10 elements so it's fast enough. My algorithm for bubble sort works cause if I code this


    void Bubble(int...
  20. Replies
    15
    Views
    37,298

    since an array of chars is basically a string,...

    since an array of chars is basically a string, why not try this...




    #include <stdio.h>
    #include <string.h>
    #include <ctype.h>

    int main (int argc, const char * argv[])
  21. Replies
    4
    Views
    2,845

    Of course, but apart from that, if the user...

    Of course, but apart from that, if the user ALWAYS enters less than 20 characters, is it ok?
  22. Replies
    4
    Views
    2,845

    returning a string from a function

    is anything wrong with this approach?


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    void str_output(char *x)
    {
    scanf("%s", x);
  23. Replies
    6
    Views
    5,599

    I guess I could/should have included a break in...

    I guess I could/should have included a break in the for loop after it finds the sought node :)
  24. Replies
    6
    Views
    5,599

    I wasn't expecting for all my problems to be...

    I wasn't expecting for all my problems to be solved. The fact that on this forum one doesn't get the code wrapped up in shiny paper is a great plus for me as it is more important to realise why...
  25. Replies
    6
    Views
    5,599

    Nope, still doesn't work! It doesn't delete the...

    Nope, still doesn't work! It doesn't delete the node i want when it does exist, but it does return 0 when i try to delete a non-existing node.

    I colored the new lines of code red


    int...
Results 1 to 25 of 74
Page 1 of 3 1 2 3