Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C++ programming question [modified]

C++ programming question [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++comdata-structurestutorial
11 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    diablaaz
    wrote on last edited by
    #1

    Hello, I have a question for you. I have a program is based on a basic binary tree. There needs to be a function to swap nodes or from left to right. so in other words, if 1 is the root and on the left is a 2 and on the right is a 3, I would want to swap the 2 and 3. For each node entered. Any ideas on how to write this out? Thanks. Tiffani Diablaaz@aol.com -- modified at 18:14 Sunday 22nd July, 2007

    M M G C M 5 Replies Last reply
    0
    • D diablaaz

      Hello, I have a question for you. I have a program is based on a basic binary tree. There needs to be a function to swap nodes or from left to right. so in other words, if 1 is the root and on the left is a 2 and on the right is a 3, I would want to swap the 2 and 3. For each node entered. Any ideas on how to write this out? Thanks. Tiffani Diablaaz@aol.com -- modified at 18:14 Sunday 22nd July, 2007

      M Offline
      M Offline
      Malcolm Smart
      wrote on last edited by
      #2

      Who's first?;)

      "More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF

      C 1 Reply Last reply
      0
      • M Malcolm Smart

        Who's first?;)

        "More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        I was tempted - but I've just finished an 8 hour drive and I'm too tired to bother.


        Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

        1 Reply Last reply
        0
        • D diablaaz

          Hello, I have a question for you. I have a program is based on a basic binary tree. There needs to be a function to swap nodes or from left to right. so in other words, if 1 is the root and on the left is a 2 and on the right is a 3, I would want to swap the 2 and 3. For each node entered. Any ideas on how to write this out? Thanks. Tiffani Diablaaz@aol.com -- modified at 18:14 Sunday 22nd July, 2007

          M Offline
          M Offline
          Marc Clifton
          wrote on last edited by
          #4

          diablaaz wrote:

          Any ideas on how to write this out?

          Homework? Take-home test? We need more info. :rolleyes: Marc

          Thyme In The Country
          Interacx
          My Blog

          P 1 Reply Last reply
          0
          • D diablaaz

            Hello, I have a question for you. I have a program is based on a basic binary tree. There needs to be a function to swap nodes or from left to right. so in other words, if 1 is the root and on the left is a 2 and on the right is a 3, I would want to swap the 2 and 3. For each node entered. Any ideas on how to write this out? Thanks. Tiffani Diablaaz@aol.com -- modified at 18:14 Sunday 22nd July, 2007

            G Offline
            G Offline
            Gary Kirkham
            wrote on last edited by
            #5

            I see your problem. You can't do that with a basic binary tree. You need to switch to an advanced binary tree.

            Gary Kirkham Forever Forgiven and Alive in the Spirit He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot Me blog, You read

            R 1 Reply Last reply
            0
            • G Gary Kirkham

              I see your problem. You can't do that with a basic binary tree. You need to switch to an advanced binary tree.

              Gary Kirkham Forever Forgiven and Alive in the Spirit He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot Me blog, You read

              R Offline
              R Offline
              Rick Engelking
              wrote on last edited by
              #6

              I'm not even sure an advanced tree would work. He might need a segmented octal tree with a U’u root.

              1 Reply Last reply
              0
              • D diablaaz

                Hello, I have a question for you. I have a program is based on a basic binary tree. There needs to be a function to swap nodes or from left to right. so in other words, if 1 is the root and on the left is a 2 and on the right is a 3, I would want to swap the 2 and 3. For each node entered. Any ideas on how to write this out? Thanks. Tiffani Diablaaz@aol.com -- modified at 18:14 Sunday 22nd July, 2007

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                Here's the text that appeared above the window where you posted this message. I'm moving it to the C++ forum, where it belongs. Please use the right forums. Rules: The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. Do not post programming questions (use the programming forums for that) and please don't post ads.

                Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                1 Reply Last reply
                0
                • D diablaaz

                  Hello, I have a question for you. I have a program is based on a basic binary tree. There needs to be a function to swap nodes or from left to right. so in other words, if 1 is the root and on the left is a 2 and on the right is a 3, I would want to swap the 2 and 3. For each node entered. Any ideas on how to write this out? Thanks. Tiffani Diablaaz@aol.com -- modified at 18:14 Sunday 22nd July, 2007

                  M Offline
                  M Offline
                  Maximilien
                  wrote on last edited by
                  #8

                  maybe change the < by a> ?


                  Maximilien Lincourt Your Head A Splode - Strong Bad

                  1 Reply Last reply
                  0
                  • M Marc Clifton

                    diablaaz wrote:

                    Any ideas on how to write this out?

                    Homework? Take-home test? We need more info. :rolleyes: Marc

                    Thyme In The Country
                    Interacx
                    My Blog

                    P Offline
                    P Offline
                    Paul Conrad
                    wrote on last edited by
                    #9

                    Marc Clifton wrote:

                    We need more info.

                    Why? Do you have a moving scale of what to charge based on if it is homework or take home test? I know I do :laugh:

                    "The clue train passed his station without stopping." - John Simmons / outlaw programmer

                    M 1 Reply Last reply
                    0
                    • P Paul Conrad

                      Marc Clifton wrote:

                      We need more info.

                      Why? Do you have a moving scale of what to charge based on if it is homework or take home test? I know I do :laugh:

                      "The clue train passed his station without stopping." - John Simmons / outlaw programmer

                      M Offline
                      M Offline
                      Marc Clifton
                      wrote on last edited by
                      #10

                      Paul Conrad wrote:

                      Why? Do you have a moving scale of what to charge based on if it is homework or take home test?

                      Because his question was originally posted in the lounge, and I wanted to know what the appropriate flame response should be. :) Marc

                      Thyme In The Country
                      Interacx
                      My Blog

                      P 1 Reply Last reply
                      0
                      • M Marc Clifton

                        Paul Conrad wrote:

                        Why? Do you have a moving scale of what to charge based on if it is homework or take home test?

                        Because his question was originally posted in the lounge, and I wanted to know what the appropriate flame response should be. :) Marc

                        Thyme In The Country
                        Interacx
                        My Blog

                        P Offline
                        P Offline
                        Paul Conrad
                        wrote on last edited by
                        #11

                        Marc Clifton wrote:

                        wanted to know what the appropriate flame response should be

                        Pick a flame, any flame :laugh:

                        "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups