Search:

Type: Posts; User: lastrial

Search: Search took 0.00 seconds.

  1. Replies
    3
    Views
    2,886

    Okay...it looks like a Binary search tree...

    Okay...it looks like a Binary search tree insertr. I wasn't sure if binary tree follows the same procedure. Thanks!
  2. Replies
    3
    Views
    2,886

    Insert elements in binary tree

    How would you insert random int in a binary tree? eg 1,5,34,90,3,56,1. What is the logic behind inserting these nodes?
  3. Replies
    1
    Views
    1,004

    Need help on these questions please

    How to read data from a disk file? process end of file and process error conditions?

    How do you compare bag and set? (I know set cannot have duplicates any other points?)
  4. Replies
    3
    Views
    1,706

    I am talking about pointer lists

    I am talking about pointer lists
  5. Replies
    3
    Views
    1,706

    how to remove even elements from list

    How to remove even elements from list without using a counter?
  6. How would I remove odd elements /even elements...

    How would I remove odd elements /even elements from a list without using a counter?
  7. Thanks to you...I didn't realise I missed writing...

    Thanks to you...I didn't realise I missed writing function name.
  8. Awesome! very concise solution! why doesn't...

    Awesome! very concise solution!

    why doesn't this work?




    int eodd(node_ptr p, int is_even)
    {
    if(p) return (p->next, !is_even);
  9. Thanks verymuch guys I followed both the...

    Thanks verymuch guys I followed both the solutions......using mod and triggering....
  10. why doesn't the code work on right part of tree?

    Idea is to swap Binary tree's element's with it's left node. Here's the code I came up with:




    TREE swap_left (TREE T){
    element_type tmp;
    if(T!=NULL){
    if(T->left){
    tmp =...
  11. helpers! Where did I go wrong in this pgm?

    I want to remove even nodes in a singly linked list. Here's is a iterative solution I wrote, which works fine:


    void remove_alternate(LIST L){
    position p,tmp_cell;
    int cnt;
    cnt = 0;
    p =...
  12. Replies
    4
    Views
    1,483

    I printed out the solution and it does look...

    I printed out the solution and it does look right....thanks for your answer Mac
  13. Replies
    4
    Views
    1,483

    Is this the right solution using while? ...

    Is this the right solution using while?




    TREE swap_left (TREE T){
    element_type tmp;
    while ((T!=NULL) && (T->left!=NULL)){
    tmp = T->element;
    T->element = T->left->element;
  14. Replies
    4
    Views
    1,483

    Another beginner 'n when to use while vs if

    I am really getting confused between using while and if loops

    eg: Here's a solution for swapping current element with it's left node in a binary tree:



    TREE swap_left (TREE T){...
  15. Oh so...using flag++ doesn't fall under using a...

    Oh so...using flag++ doesn't fall under using a counter huh.....thanks for clearing that up. Thanks very much happy reaper.
  16. I am not supposed to use a counter and code shown...

    I am not supposed to use a counter and code shown above uses it.
  17. hmmmmm....

    This what I have come up with.....donno where I goofed up




    int counters (LIST L){
    int flag = 0;
    position p;
    p = L->head->next;
    if (p){
  18. Replies
    2
    Views
    990

    Can any one please explain this

    For the same question above, the solution given was:



    int hasPathSum(struct tree_node* node, int sum) {
    // return true if we run out of tree and sum==0
    if (node == NULL) {
    ...
  19. Replies
    2
    Views
    990

    Beginner's question

    Here's a sample code I came up for the following question :

    Given a tree and a sum, return true if there is a path from the root
    down to a leaf, such that adding up all the values along the path...
  20. Please help! I need a solution for this question

    Consider a singly-linked list of nodes, where each node contains an integer and a pointer.

    a)Write an ITERATIVE function that returns TRUE (1) if the list has an EVEN number of nodes; otherwise...
Results 1 to 20 of 20