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. Algorithms
  4. Find an algorithm

Find an algorithm

Scheduled Pinned Locked Moved Algorithms
algorithmsdebuggingregexquestionlearning
37 Posts 14 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.
  • A ashishpahlaz

    result = ((f&&f1) || (d&&d1) || (r&&r1)) && (f||f1) && (d||d1) && (r||r1)

    L Offline
    L Offline
    Luc Pattyn
    wrote on last edited by
    #23

    incorrect, none of the test cases have (f||f1) true. :|

    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

    Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

    A 1 Reply Last reply
    0
    • L Luc Pattyn

      incorrect, none of the test cases have (f||f1) true. :|

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      A Offline
      A Offline
      ashishpahlaz
      wrote on last edited by
      #24

      result = ((f&&f1) || (d&&d1) || (r&r1)) && (f==f1) && (d==d1) && (r==r1);

      1 Reply Last reply
      0
      • N Not Active

        I've probably been staring at this far too long but I can't find an algorithm that will return the correct results for the code below. Anyone have some fresh ideas?

        private void Test()
        {
        Logic(false, false, false, false, false, false, false);
        Logic(false, false, false, false, true, true, true);
        Logic(false, false, false, false, true, false, false);
        Logic(false, false, true, false, true, true, false);
        Logic(false, false, true, true, true, true, true);
        }

        private void Logic(bool f, bool fl, bool d, bool dl, bool r, bool rl, bool expected)
        {
        bool result = [What algorithm goes here];

        System.Diagnostics.Debug.Assert(result == expected, "Does not match expected results");
        

        }


        I know the language. I've read a book. - _Madmatt

        T Offline
        T Offline
        Tadeusz Westawic
        wrote on last edited by
        #25

        Is it simply the number of TRUE arguments passed? No TRUE args ==> FALSE even no of TRUE args ==> TRUE Otherwise ==> FALSE :confused: Tadeusz Westawic Sum quid sum.

        N 1 Reply Last reply
        0
        • N Not Active

          I've probably been staring at this far too long but I can't find an algorithm that will return the correct results for the code below. Anyone have some fresh ideas?

          private void Test()
          {
          Logic(false, false, false, false, false, false, false);
          Logic(false, false, false, false, true, true, true);
          Logic(false, false, false, false, true, false, false);
          Logic(false, false, true, false, true, true, false);
          Logic(false, false, true, true, true, true, true);
          }

          private void Logic(bool f, bool fl, bool d, bool dl, bool r, bool rl, bool expected)
          {
          bool result = [What algorithm goes here];

          System.Diagnostics.Debug.Assert(result == expected, "Does not match expected results");
          

          }


          I know the language. I've read a book. - _Madmatt

          F Offline
          F Offline
          fjdiewornncalwe
          wrote on last edited by
          #26

          ( ( d && dl ) && ( r && rl ) ) || ( (d && dl) && ( !r && !rl) ) || ( (!d && !dl) && ( r && rl ) )

          I wasn't, now I am, then I won't be anymore.

          N 1 Reply Last reply
          0
          • T Tadeusz Westawic

            Is it simply the number of TRUE arguments passed? No TRUE args ==> FALSE even no of TRUE args ==> TRUE Otherwise ==> FALSE :confused: Tadeusz Westawic Sum quid sum.

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #27

            What are you confused about? Perhaps you are confused that the problem had been solved 18 days ago by people how were not confused.:confused:


            I know the language. I've read a book. - _Madmatt

            T 1 Reply Last reply
            0
            • F fjdiewornncalwe

              ( ( d && dl ) && ( r && rl ) ) || ( (d && dl) && ( !r && !rl) ) || ( (!d && !dl) && ( r && rl ) )

              I wasn't, now I am, then I won't be anymore.

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #28

              Only 18 days after everyone else. Glad it wasn't urgentz


              I know the language. I've read a book. - _Madmatt

              F 1 Reply Last reply
              0
              • N Not Active

                What are you confused about? Perhaps you are confused that the problem had been solved 18 days ago by people how were not confused.:confused:


                I know the language. I've read a book. - _Madmatt

                T Offline
                T Offline
                Tadeusz Westawic
                wrote on last edited by
                #29

                There are unanswered posts of my own that are months old and I would still appreciate any other point of view as long as it is mathematically valid and programmable. Are you saying my post is illegal? Take off that heavy badge once in a while. Tadeusz Westawic Sum quid sum.

                N 1 Reply Last reply
                0
                • N Not Active

                  Only 18 days after everyone else. Glad it wasn't urgentz


                  I know the language. I've read a book. - _Madmatt

                  F Offline
                  F Offline
                  fjdiewornncalwe
                  wrote on last edited by
                  #30

                  :laugh: I didn't even notice that. Man, do I suck... :-D

                  I wasn't, now I am, then I won't be anymore.

                  1 Reply Last reply
                  0
                  • T Tadeusz Westawic

                    There are unanswered posts of my own that are months old and I would still appreciate any other point of view as long as it is mathematically valid and programmable. Are you saying my post is illegal? Take off that heavy badge once in a while. Tadeusz Westawic Sum quid sum.

                    N Offline
                    N Offline
                    Not Active
                    wrote on last edited by
                    #31

                    Tadeusz Westawic wrote:

                    There are unanswered posts of my own

                    There is the difference. This post was answered by several people quite a long time ago.

                    Tadeusz Westawic wrote:

                    Are you saying my post is illegal?

                    losen up and perhaps vist more often


                    I know the language. I've read a book. - _Madmatt

                    1 Reply Last reply
                    0
                    • N Not Active

                      I've probably been staring at this far too long but I can't find an algorithm that will return the correct results for the code below. Anyone have some fresh ideas?

                      private void Test()
                      {
                      Logic(false, false, false, false, false, false, false);
                      Logic(false, false, false, false, true, true, true);
                      Logic(false, false, false, false, true, false, false);
                      Logic(false, false, true, false, true, true, false);
                      Logic(false, false, true, true, true, true, true);
                      }

                      private void Logic(bool f, bool fl, bool d, bool dl, bool r, bool rl, bool expected)
                      {
                      bool result = [What algorithm goes here];

                      System.Diagnostics.Debug.Assert(result == expected, "Does not match expected results");
                      

                      }


                      I know the language. I've read a book. - _Madmatt

                      R Offline
                      R Offline
                      Radhakrishnan G
                      wrote on last edited by
                      #32

                      private void Logic( bool f1, bol f2, bool f3, bool f4, bool f5, bool f6, bool expected)
                      {
                      bool result = ((!f1) && (!f2) && f5 && f6 && ( ((!f3) && (!f4)) || ( f3 && f4 )));
                      System.Diagnostics.Debug.Assert( result == expected, "Does not match expected results" );
                      }

                      1 Reply Last reply
                      0
                      • N Not Active

                        I've probably been staring at this far too long but I can't find an algorithm that will return the correct results for the code below. Anyone have some fresh ideas?

                        private void Test()
                        {
                        Logic(false, false, false, false, false, false, false);
                        Logic(false, false, false, false, true, true, true);
                        Logic(false, false, false, false, true, false, false);
                        Logic(false, false, true, false, true, true, false);
                        Logic(false, false, true, true, true, true, true);
                        }

                        private void Logic(bool f, bool fl, bool d, bool dl, bool r, bool rl, bool expected)
                        {
                        bool result = [What algorithm goes here];

                        System.Diagnostics.Debug.Assert(result == expected, "Does not match expected results");
                        

                        }


                        I know the language. I've read a book. - _Madmatt

                        R Offline
                        R Offline
                        RobCroll
                        wrote on last edited by
                        #33

                        yeah I know it was answered a while ago but here is a slightly more elegant algorithm bool result = (f == fl) && (d == dl) && (r == rl) ? f | d | r : false; or in a less descriptive form bool result = f == fl && d == dl && r == rl && f | d | r;

                        modified on Tuesday, November 9, 2010 6:28 PM

                        N 1 Reply Last reply
                        0
                        • R RobCroll

                          yeah I know it was answered a while ago but here is a slightly more elegant algorithm bool result = (f == fl) && (d == dl) && (r == rl) ? f | d | r : false; or in a less descriptive form bool result = f == fl && d == dl && r == rl && f | d | r;

                          modified on Tuesday, November 9, 2010 6:28 PM

                          N Offline
                          N Offline
                          Not Active
                          wrote on last edited by
                          #34

                          Such a timely response :rolleyes:


                          I know the language. I've read a book. - _Madmatt

                          R 1 Reply Last reply
                          0
                          • N Not Active

                            Such a timely response :rolleyes:


                            I know the language. I've read a book. - _Madmatt

                            R Offline
                            R Offline
                            RobCroll
                            wrote on last edited by
                            #35

                            Well I teach at college so I didn't want to think I was doing your homework for you. ;P

                            N 1 Reply Last reply
                            0
                            • R RobCroll

                              Well I teach at college so I didn't want to think I was doing your homework for you. ;P

                              N Offline
                              N Offline
                              Not Active
                              wrote on last edited by
                              #36

                              Robert Croll wrote:

                              Well I teach at college

                              What course do you teach, procrastination?


                              I know the language. I've read a book. - _Madmatt

                              R 1 Reply Last reply
                              0
                              • N Not Active

                                Robert Croll wrote:

                                Well I teach at college

                                What course do you teach, procrastination?


                                I know the language. I've read a book. - _Madmatt

                                R Offline
                                R Offline
                                RobCroll
                                wrote on last edited by
                                #37

                                :laugh: :laugh: Can I get back to you on that?

                                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