Linked List

Discussion in 'C Programming' started by venkatesh.k.desai5@gmail.com, May 18, 2006.

  1. Guest

    Given a linked list with the following property
    node2 is left child of node1, if node2 < node1
    els, it is the right child.

    O P
    |
    |
    O A
    |
    |
    O B
    |
    |
    O C

    How do you convert the above linked list to the
    form without disturbing the property.

    O P
    |
    |
    O B
    / \
    / \
    / \
    O ? O ?

    where do A and C go?
    , May 18, 2006
    #1
    1. Advertising

  2. Jack Klein Guest

    On 17 May 2006 22:16:44 -0700, ""
    <> wrote in comp.lang.c:

    > Given a linked list with the following property
    > node2 is left child of node1, if node2 < node1
    > els, it is the right child.
    >
    > O P
    > |
    > |
    > O A
    > |
    > |
    > O B
    > |
    > |
    > O C
    >
    > How do you convert the above linked list to the
    > form without disturbing the property.
    >
    > O P
    > |
    > |
    > O B
    > / \
    > / \
    > / \
    > O ? O ?
    >
    > where do A and C go?


    What is your question about the C programming language?

    Also, your first example link list does not have the property you
    describe, so there is no way to do what you ask. You cannot disturb a
    property that is not present.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, May 18, 2006
    #2
    1. Advertising

  3. jacob navia Guest

    Jack Klein a écrit :
    > On 17 May 2006 22:16:44 -0700, ""
    > <> wrote in comp.lang.c:
    >
    >
    >> Given a linked list with the following property
    >> node2 is left child of node1, if node2 < node1
    >> els, it is the right child.
    >>
    >> O P
    >> |
    >> |
    >> O A
    >> |
    >> |
    >> O B
    >> |
    >> |
    >> O C
    >>
    >> How do you convert the above linked list to the
    >> form without disturbing the property.
    >>
    >> O P
    >> |
    >> |
    >> O B
    >> / \
    >> / \
    >> / \
    >> O ? O ?
    >>
    >> where do A and C go?

    >
    >
    > What is your question about the C programming language?
    >
    > Also, your first example link list does not have the property you
    > describe, so there is no way to do what you ask. You cannot disturb a
    > property that is not present.
    >


    This guy doesn't even know how to cut/paste the homework correctly!
    jacob navia, May 18, 2006
    #3
  4. pete Guest

    wrote:
    >
    > Given a linked list with the following property
    > node2 is left child of node1, if node2 < node1
    > els, it is the right child.


    That looks a heap, of the heapsort variety,
    but not of the "stack and the heap" variety.

    >
    > O P
    > |
    > |
    > O A
    > |
    > |
    > O B
    > |
    > |
    > O C
    >
    > How do you convert the above linked list to the
    > form without disturbing the property.
    >
    > O P
    > |
    > |
    > O B
    > / \
    > / \
    > / \
    > O ? O ?
    >
    > where do A and C go?


    P has two children. You only show one.

    Followup To: news:comp.programming

    --
    pete
    pete, May 18, 2006
    #4
  5. Ben Pfaff Guest

    "" <> writes:

    > How do you convert the above linked list to the
    > form without disturbing the property.


    http://adtinfo.org/libavl.html/Balancing-a-BST.html
    --
    "We put [the best] Assembler programmers in a little glass case in the hallway
    near the Exit sign. The sign on the case says, `In case of optimization
    problem, break glass.' Meanwhile, the problem solvers are busy doing their
    work in languages most appropriate to the job at hand." --Richard Riehle
    Ben Pfaff, May 18, 2006
    #5
  6. "Jack Klein" <> wrote in message
    news:...
    > On 17 May 2006 22:16:44 -0700, ""
    > <> wrote in comp.lang.c:
    >
    > > Given a linked list with the following property
    > > node2 is left child of node1, if node2 < node1
    > > els, it is the right child.
    > >
    > > O P
    > > |
    > > |
    > > O A
    > > |
    > > |
    > > O B
    > > |
    > > |
    > > O C
    > >
    > > How do you convert the above linked list to the
    > > form without disturbing the property.
    > >
    > > O P
    > > |
    > > |
    > > O B
    > > / \
    > > / \
    > > / \
    > > O ? O ?
    > >
    > > where do A and C go?

    >
    > What is your question about the C programming language?
    >
    > Also, your first example link list does not have the property you
    > describe, so there is no way to do what you ask. You cannot disturb a
    > property that is not present.
    >


    In regards to:
    > cannot


    I think you meant to use "can't" here... Use of contractions should be
    avoided in a formal situation, such as a research paper. But, research
    shows that not using contractions in informal situations is a solid
    indicator of lying.


    e.g., "I did not have sexual relations with that woman," Bill Clinton


    Rod Pemberton
    Rod Pemberton, May 18, 2006
    #6
  7. Al Balmer Guest

    On Thu, 18 May 2006 14:44:00 -0400, "Rod Pemberton"
    <> wrote:

    >In regards to:
    >> cannot

    >
    >I think you meant to use "can't" here... Use of contractions should be
    >avoided in a formal situation, such as a research paper. But, research
    >shows that not using contractions in informal situations is a solid
    >indicator of lying.


    Posting such nonsense is a solid indicator of trolling.

    --
    Al Balmer
    Sun City, AZ
    Al Balmer, May 18, 2006
    #7
  8. "Al Balmer" <> wrote in message
    news:...
    > On Thu, 18 May 2006 14:44:00 -0400, "Rod Pemberton"
    > <> wrote:
    >
    > >In regards to:
    > >> cannot

    > >
    > >I think you meant to use "can't" here... Use of contractions should be
    > >avoided in a formal situation, such as a research paper. But, research
    > >shows that not using contractions in informal situations is a solid
    > >indicator of lying.

    >
    > Posting such nonsense is a solid indicator of trolling.
    >


    It's not nonsense or trolling. When I read his statements, the first
    thought I had was "why is he lying?". I pointed out as courtesy because I
    couldn't figure out why he'd be lying. And, as I stated, I didn't think he
    was. Also, research does confirm it.


    Rod Pemberton
    Rod Pemberton, May 18, 2006
    #8
  9. Al Balmer Guest

    On Thu, 18 May 2006 17:04:40 -0400, "Rod Pemberton"
    <> wrote:

    >
    >"Al Balmer" <> wrote in message
    >news:...
    >> On Thu, 18 May 2006 14:44:00 -0400, "Rod Pemberton"
    >> <> wrote:
    >>
    >> >In regards to:
    >> >> cannot
    >> >
    >> >I think you meant to use "can't" here... Use of contractions should be
    >> >avoided in a formal situation, such as a research paper. But, research
    >> >shows that not using contractions in informal situations is a solid
    >> >indicator of lying.

    >>
    >> Posting such nonsense is a solid indicator of trolling.
    >>

    >
    >It's not nonsense or trolling. When I read his statements, the first
    >thought I had was "why is he lying?". I pointed out as courtesy because I
    >couldn't figure out why he'd be lying. And, as I stated, I didn't think he
    >was.


    So he wasn't.

    > Also, research does confirm it.


    And your observation above disproves it.

    --
    Al Balmer
    Sun City, AZ
    Al Balmer, May 19, 2006
    #9
  10. Jack Klein Guest

    On Thu, 18 May 2006 14:44:00 -0400, "Rod Pemberton"
    <> wrote in comp.lang.c:

    >
    > "Jack Klein" <> wrote in message
    > news:...
    > > On 17 May 2006 22:16:44 -0700, ""
    > > <> wrote in comp.lang.c:
    > >
    > > > Given a linked list with the following property
    > > > node2 is left child of node1, if node2 < node1
    > > > els, it is the right child.
    > > >
    > > > O P
    > > > |
    > > > |
    > > > O A
    > > > |
    > > > |
    > > > O B
    > > > |
    > > > |
    > > > O C
    > > >
    > > > How do you convert the above linked list to the
    > > > form without disturbing the property.
    > > >
    > > > O P
    > > > |
    > > > |
    > > > O B
    > > > / \
    > > > / \
    > > > / \
    > > > O ? O ?
    > > >
    > > > where do A and C go?

    > >
    > > What is your question about the C programming language?
    > >
    > > Also, your first example link list does not have the property you
    > > describe, so there is no way to do what you ask. You cannot disturb a
    > > property that is not present.
    > >

    >
    > In regards to:
    > > cannot

    >
    > I think you meant to use "can't" here... Use of contractions should be
    > avoided in a formal situation, such as a research paper. But, research
    > shows that not using contractions in informal situations is a solid
    > indicator of lying.
    >
    >
    > e.g., "I did not have sexual relations with that woman," Bill Clinton


    "I did not have sexual relations with Bill Clinton", me.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, May 19, 2006
    #10
  11. "Al Balmer" <> wrote in message
    news:...
    > On Thu, 18 May 2006 17:04:40 -0400, "Rod Pemberton"
    > <> wrote:
    >
    > >
    > >"Al Balmer" <> wrote in message
    > >news:...
    > >> On Thu, 18 May 2006 14:44:00 -0400, "Rod Pemberton"
    > >> <> wrote:
    > >>
    > >> >In regards to:
    > >> >> cannot
    > >> >
    > >> >I think you meant to use "can't" here... Use of contractions should

    be
    > >> >avoided in a formal situation, such as a research paper. But,

    research
    > >> >shows that not using contractions in informal situations is a solid
    > >> >indicator of lying.
    > >>
    > >> Posting such nonsense is a solid indicator of trolling.
    > >>

    > >
    > >It's not nonsense or trolling. When I read his statements, the first
    > >thought I had was "why is he lying?". I pointed out as courtesy because

    I
    > >couldn't figure out why he'd be lying. And, as I stated, I didn't think

    he
    > >was.

    >
    > So he wasn't.
    >
    > > Also, research does confirm it.

    >
    > And your observation above disproves it.
    >


    Faulty logic. My assumption doesn't prove anything about the intent his
    statements. He could've been lying or telling the truth.


    Rod Pemberton
    Rod Pemberton, May 19, 2006
    #11
  12. "Jack Klein" <> wrote in message
    news:...
    > On Thu, 18 May 2006 14:44:00 -0400, "Rod Pemberton"
    > <> wrote in comp.lang.c:
    >
    > >
    > > "Jack Klein" <> wrote in message
    > > news:...
    > > > On 17 May 2006 22:16:44 -0700, ""
    > > > <> wrote in comp.lang.c:
    > > >
    > > > > Given a linked list with the following property
    > > > > node2 is left child of node1, if node2 < node1
    > > > > els, it is the right child.
    > > > >
    > > > > O P
    > > > > |
    > > > > |
    > > > > O A
    > > > > |
    > > > > |
    > > > > O B
    > > > > |
    > > > > |
    > > > > O C
    > > > >
    > > > > How do you convert the above linked list to the
    > > > > form without disturbing the property.
    > > > >
    > > > > O P
    > > > > |
    > > > > |
    > > > > O B
    > > > > / \
    > > > > / \
    > > > > / \
    > > > > O ? O ?
    > > > >
    > > > > where do A and C go?
    > > >
    > > > What is your question about the C programming language?
    > > >
    > > > Also, your first example link list does not have the property you
    > > > describe, so there is no way to do what you ask. You cannot disturb a
    > > > property that is not present.
    > > >

    > >
    > > In regards to:
    > > > cannot

    > >
    > > I think you meant to use "can't" here... Use of contractions should be
    > > avoided in a formal situation, such as a research paper. But, research
    > > shows that not using contractions in informal situations is a solid
    > > indicator of lying.
    > >
    > >
    > > e.g., "I did not have sexual relations with that woman," Bill Clinton

    >
    > "I did not have sexual relations with Bill Clinton", me.
    >


    (ugh, sick, twisted...)

    Did you have him sign your cigar?


    Rod Pemberton
    Rod Pemberton, May 19, 2006
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Ritchey
    Replies:
    7
    Views:
    479
    emerth
    Jul 10, 2003
  2. Chris Ritchey

    Generating a char* from a linked list of linked lists

    Chris Ritchey, Jul 9, 2003, in forum: C Programming
    Replies:
    7
    Views:
    465
    emerth
    Jul 10, 2003
  3. fool
    Replies:
    14
    Views:
    504
    Barry Schwarz
    Jul 3, 2006
  4. joshd
    Replies:
    12
    Views:
    665
    John Carson
    Oct 2, 2006
  5. jawdoc
    Replies:
    9
    Views:
    751
    Chris Thomasson
    Mar 10, 2008
Loading...

Share This Page