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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Lets Discuss ... Some Important Topics

Lets Discuss ... Some Important Topics

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresquestioncsscryptography
11 Posts 7 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 Offline
    A Offline
    AryaSoft
    wrote on last edited by
    #1

    Data Structures 1. Which case you will use an array / Linked list? 2. Find the second maximum in an array? (Fastest way / better methodology) 3. How many comparisons you need to find second maximum? 4. How does a Binary search work? 5. How will you merge these two arrays? Write the program Array: A 1 18 22 43 Array: B 3 4 6 20 34 46 55 Output Array: C 1 3 4 6 18 20 22 34 43 46 55 6. How do u create Hashtable in C? 7. What is hash collision? 8. What is the output of the following c program #define calc(x) { 2*x} a=2; b=3; printf calc(a+b); printf calc(b+a); 9. Algo to find the 2nd max value in an array. 10. What is the difference between signed int and unsigned int? 11. Consider a singular link list with ‘N’ elements. One of the nodes doesn’t point to the next consecutive node instead it points to some other node in the beginning, thus leading into an infinite loop. How will you detect that there was an infinite loop and find the node that lead to the infinite loop. 12. Consider two stacks; Stack A and Stack B. Implement a Queue using these 2 stacks. (Need to implement Push & Pull) 13. Under what circumstances can one delete an element from a singly linked list in constant time? 14. Given a singly linked list, determine whether it contains a loop or not. 15. Given a singly linked list, print out its contents in reverse order. Can you do it without using any extra space? ANS. Start reversing the list. Do this again, printing the contents. 16. Given a binary tree with nodes, print out the values in pre-order/in-order/post-order without using any extra space. 17. Reverse a singly linked list recursively. The function prototype is node * reverse (node *) ; 18. Given a singly linked list, find the middle of the list. HINT. Use the single and double pointer jumping. Maintain two pointers, initially pointing to the head. Advance one of them one node at a time. And the other one, two nodes at a time. When the double reaches the end, the single is in the middle. This is not asymptotically faster but seems to take less steps than going through the list twice. 19. Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ? 20. You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above. 21. Given an array

    M W C B 5 Replies Last reply
    0
    • A AryaSoft

      Data Structures 1. Which case you will use an array / Linked list? 2. Find the second maximum in an array? (Fastest way / better methodology) 3. How many comparisons you need to find second maximum? 4. How does a Binary search work? 5. How will you merge these two arrays? Write the program Array: A 1 18 22 43 Array: B 3 4 6 20 34 46 55 Output Array: C 1 3 4 6 18 20 22 34 43 46 55 6. How do u create Hashtable in C? 7. What is hash collision? 8. What is the output of the following c program #define calc(x) { 2*x} a=2; b=3; printf calc(a+b); printf calc(b+a); 9. Algo to find the 2nd max value in an array. 10. What is the difference between signed int and unsigned int? 11. Consider a singular link list with ‘N’ elements. One of the nodes doesn’t point to the next consecutive node instead it points to some other node in the beginning, thus leading into an infinite loop. How will you detect that there was an infinite loop and find the node that lead to the infinite loop. 12. Consider two stacks; Stack A and Stack B. Implement a Queue using these 2 stacks. (Need to implement Push & Pull) 13. Under what circumstances can one delete an element from a singly linked list in constant time? 14. Given a singly linked list, determine whether it contains a loop or not. 15. Given a singly linked list, print out its contents in reverse order. Can you do it without using any extra space? ANS. Start reversing the list. Do this again, printing the contents. 16. Given a binary tree with nodes, print out the values in pre-order/in-order/post-order without using any extra space. 17. Reverse a singly linked list recursively. The function prototype is node * reverse (node *) ; 18. Given a singly linked list, find the middle of the list. HINT. Use the single and double pointer jumping. Maintain two pointers, initially pointing to the head. Advance one of them one node at a time. And the other one, two nodes at a time. When the double reaches the end, the single is in the middle. This is not asymptotically faster but seems to take less steps than going through the list twice. 19. Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ? 20. You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above. 21. Given an array

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      Lets forget the smart replies about doing homework. I think you stole the whole goddam exam paper!

      M 1 Reply Last reply
      0
      • A AryaSoft

        Data Structures 1. Which case you will use an array / Linked list? 2. Find the second maximum in an array? (Fastest way / better methodology) 3. How many comparisons you need to find second maximum? 4. How does a Binary search work? 5. How will you merge these two arrays? Write the program Array: A 1 18 22 43 Array: B 3 4 6 20 34 46 55 Output Array: C 1 3 4 6 18 20 22 34 43 46 55 6. How do u create Hashtable in C? 7. What is hash collision? 8. What is the output of the following c program #define calc(x) { 2*x} a=2; b=3; printf calc(a+b); printf calc(b+a); 9. Algo to find the 2nd max value in an array. 10. What is the difference between signed int and unsigned int? 11. Consider a singular link list with ‘N’ elements. One of the nodes doesn’t point to the next consecutive node instead it points to some other node in the beginning, thus leading into an infinite loop. How will you detect that there was an infinite loop and find the node that lead to the infinite loop. 12. Consider two stacks; Stack A and Stack B. Implement a Queue using these 2 stacks. (Need to implement Push & Pull) 13. Under what circumstances can one delete an element from a singly linked list in constant time? 14. Given a singly linked list, determine whether it contains a loop or not. 15. Given a singly linked list, print out its contents in reverse order. Can you do it without using any extra space? ANS. Start reversing the list. Do this again, printing the contents. 16. Given a binary tree with nodes, print out the values in pre-order/in-order/post-order without using any extra space. 17. Reverse a singly linked list recursively. The function prototype is node * reverse (node *) ; 18. Given a singly linked list, find the middle of the list. HINT. Use the single and double pointer jumping. Maintain two pointers, initially pointing to the head. Advance one of them one node at a time. And the other one, two nodes at a time. When the double reaches the end, the single is in the middle. This is not asymptotically faster but seems to take less steps than going through the list twice. 19. Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ? 20. You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above. 21. Given an array

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        :laugh::laugh::laugh:

        B 1 Reply Last reply
        0
        • A AryaSoft

          Data Structures 1. Which case you will use an array / Linked list? 2. Find the second maximum in an array? (Fastest way / better methodology) 3. How many comparisons you need to find second maximum? 4. How does a Binary search work? 5. How will you merge these two arrays? Write the program Array: A 1 18 22 43 Array: B 3 4 6 20 34 46 55 Output Array: C 1 3 4 6 18 20 22 34 43 46 55 6. How do u create Hashtable in C? 7. What is hash collision? 8. What is the output of the following c program #define calc(x) { 2*x} a=2; b=3; printf calc(a+b); printf calc(b+a); 9. Algo to find the 2nd max value in an array. 10. What is the difference between signed int and unsigned int? 11. Consider a singular link list with ‘N’ elements. One of the nodes doesn’t point to the next consecutive node instead it points to some other node in the beginning, thus leading into an infinite loop. How will you detect that there was an infinite loop and find the node that lead to the infinite loop. 12. Consider two stacks; Stack A and Stack B. Implement a Queue using these 2 stacks. (Need to implement Push & Pull) 13. Under what circumstances can one delete an element from a singly linked list in constant time? 14. Given a singly linked list, determine whether it contains a loop or not. 15. Given a singly linked list, print out its contents in reverse order. Can you do it without using any extra space? ANS. Start reversing the list. Do this again, printing the contents. 16. Given a binary tree with nodes, print out the values in pre-order/in-order/post-order without using any extra space. 17. Reverse a singly linked list recursively. The function prototype is node * reverse (node *) ; 18. Given a singly linked list, find the middle of the list. HINT. Use the single and double pointer jumping. Maintain two pointers, initially pointing to the head. Advance one of them one node at a time. And the other one, two nodes at a time. When the double reaches the end, the single is in the middle. This is not asymptotically faster but seems to take less steps than going through the list twice. 19. Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ? 20. You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above. 21. Given an array

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          AryaSoft wrote:

          7. What is hash collision?

          Oh wait, I remember this one from college. Something to do with two hash pipes passed different directions and the ensuing chaos... :rolleyes:

          1 Reply Last reply
          0
          • A AryaSoft

            Data Structures 1. Which case you will use an array / Linked list? 2. Find the second maximum in an array? (Fastest way / better methodology) 3. How many comparisons you need to find second maximum? 4. How does a Binary search work? 5. How will you merge these two arrays? Write the program Array: A 1 18 22 43 Array: B 3 4 6 20 34 46 55 Output Array: C 1 3 4 6 18 20 22 34 43 46 55 6. How do u create Hashtable in C? 7. What is hash collision? 8. What is the output of the following c program #define calc(x) { 2*x} a=2; b=3; printf calc(a+b); printf calc(b+a); 9. Algo to find the 2nd max value in an array. 10. What is the difference between signed int and unsigned int? 11. Consider a singular link list with ‘N’ elements. One of the nodes doesn’t point to the next consecutive node instead it points to some other node in the beginning, thus leading into an infinite loop. How will you detect that there was an infinite loop and find the node that lead to the infinite loop. 12. Consider two stacks; Stack A and Stack B. Implement a Queue using these 2 stacks. (Need to implement Push & Pull) 13. Under what circumstances can one delete an element from a singly linked list in constant time? 14. Given a singly linked list, determine whether it contains a loop or not. 15. Given a singly linked list, print out its contents in reverse order. Can you do it without using any extra space? ANS. Start reversing the list. Do this again, printing the contents. 16. Given a binary tree with nodes, print out the values in pre-order/in-order/post-order without using any extra space. 17. Reverse a singly linked list recursively. The function prototype is node * reverse (node *) ; 18. Given a singly linked list, find the middle of the list. HINT. Use the single and double pointer jumping. Maintain two pointers, initially pointing to the head. Advance one of them one node at a time. And the other one, two nodes at a time. When the double reaches the end, the single is in the middle. This is not asymptotically faster but seems to take less steps than going through the list twice. 19. Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ? 20. You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above. 21. Given an array

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            Do you really think that someone here has soo much time to loose ? X|


            Cédric Moonen Software developer
            Charting control [Updated - v1.1]

            W A 2 Replies Last reply
            0
            • W Waldermort

              Lets forget the smart replies about doing homework. I think you stole the whole goddam exam paper!

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              :laugh: This is the best one I've ever seen! Legendary! Damn, I've got alot of work to do if I'm going to respond to this one. Cheers, Mark

              L 1 Reply Last reply
              0
              • C Cedric Moonen

                Do you really think that someone here has soo much time to loose ? X|


                Cédric Moonen Software developer
                Charting control [Updated - v1.1]

                W Offline
                W Offline
                Waldermort
                wrote on last edited by
                #7

                Mark obviously does :rolleyes:

                1 Reply Last reply
                0
                • M Mark Salsbery

                  :laugh: This is the best one I've ever seen! Legendary! Damn, I've got alot of work to do if I'm going to respond to this one. Cheers, Mark

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #8

                  Mark Salsbery wrote:

                  Legendary!

                  :laugh::laugh::laugh: Software development is a race between the programmers building bigger and better software and the universe building bigger and better idiots, so far the universe is winning.

                  led mike

                  1 Reply Last reply
                  0
                  • C Cedric Moonen

                    Do you really think that someone here has soo much time to loose ? X|


                    Cédric Moonen Software developer
                    Charting control [Updated - v1.1]

                    A Offline
                    A Offline
                    AryaSoft
                    wrote on last edited by
                    #9

                    This topic is not about answering a question ... instead it is about discussing various ways in which any of this questions can be tackled! And guys for your info its not an Home Work Assignment ... They are just some topics I found! And btw Nobody needs to discuss about all ... if you CAN dare to discuss any one of them, thats more than enough

                    1 Reply Last reply
                    0
                    • M Mark Salsbery

                      :laugh::laugh::laugh:

                      B Offline
                      B Offline
                      Bram van Kampen
                      wrote on last edited by
                      #10

                      Is this an attempt to the 2006 version of the 'Erlangen' Program?? Are there any mathematicians left amongst you to remember about that one? The 4 Colour problem, Fermats' theorem, and several bakers dozens more! This was posted either by an idiot trying to pull of an exam scam or something like it, or else by one of the elder statesmen of computing. I suspect the former, but offer to eat humble pie for the next two hours if it turns out to be the latter. regards

                      LateNightsInNewry

                      1 Reply Last reply
                      0
                      • A AryaSoft

                        Data Structures 1. Which case you will use an array / Linked list? 2. Find the second maximum in an array? (Fastest way / better methodology) 3. How many comparisons you need to find second maximum? 4. How does a Binary search work? 5. How will you merge these two arrays? Write the program Array: A 1 18 22 43 Array: B 3 4 6 20 34 46 55 Output Array: C 1 3 4 6 18 20 22 34 43 46 55 6. How do u create Hashtable in C? 7. What is hash collision? 8. What is the output of the following c program #define calc(x) { 2*x} a=2; b=3; printf calc(a+b); printf calc(b+a); 9. Algo to find the 2nd max value in an array. 10. What is the difference between signed int and unsigned int? 11. Consider a singular link list with ‘N’ elements. One of the nodes doesn’t point to the next consecutive node instead it points to some other node in the beginning, thus leading into an infinite loop. How will you detect that there was an infinite loop and find the node that lead to the infinite loop. 12. Consider two stacks; Stack A and Stack B. Implement a Queue using these 2 stacks. (Need to implement Push & Pull) 13. Under what circumstances can one delete an element from a singly linked list in constant time? 14. Given a singly linked list, determine whether it contains a loop or not. 15. Given a singly linked list, print out its contents in reverse order. Can you do it without using any extra space? ANS. Start reversing the list. Do this again, printing the contents. 16. Given a binary tree with nodes, print out the values in pre-order/in-order/post-order without using any extra space. 17. Reverse a singly linked list recursively. The function prototype is node * reverse (node *) ; 18. Given a singly linked list, find the middle of the list. HINT. Use the single and double pointer jumping. Maintain two pointers, initially pointing to the head. Advance one of them one node at a time. And the other one, two nodes at a time. When the double reaches the end, the single is in the middle. This is not asymptotically faster but seems to take less steps than going through the list twice. 19. Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ? 20. You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above. 21. Given an array

                        B Offline
                        B Offline
                        Blake Miller
                        wrote on last edited by
                        #11

                        37 - Don't use locks!

                        Any sufficiently gross incompetence is nearly indistinguishable from malice.

                        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