Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  
  2. Joanna Szczesniak: Q1. Write a function in C/C++ to determine if a string starts with a numeric value (0-9)
  3. (No function calls, no stl libraries)
  4. bool StartsWithNumeric(char* szString)
  5. {
  6. }
  7.  
  8. Joanna Szczesniak: Q.2 Given an interger array of arbituary size, can you find a way to find duplicates values in it?
  9. (No function calls, no stl libraries)
  10. bool hasDuplicate( int* pnValues, int nSize)
  11. {
  12. }
  13.  
  14. Joanna Szczesniak: Q3. Can you briefly describe what does the function(s) below perform?
  15.  
  16. struct Snode {
  17.       Snode*   p1;
  18.       Snode*   p2;
  19.       int          nValue;
  20. };
  21.  
  22. bool Test( int nValue, Snode* psRoot )
  23. {
  24.     if ( NULL ==  psRoot ) {
  25.  return false;
  26.     }
  27.     if ( psRoot->nValue >  nValue ) {
  28.  if ( NULL !=  psRoot->p1 ) {
  29.         return Test( nValue, psRoot->p1 );
  30.  }
  31.  psRoot->p1 = new Snode;
  32.  if ( NULL ==  psRoot->p1 ) {
  33.      return false;
  34.          }
  35.  psRoot->p1->p1 = NULL;
  36.  psRoot->p1->p2 = NULL;
  37.  psRoot->p1->nValue = nValue;
  38.  return true;
  39.     }
  40.     else {
  41.  if ( NULL !=  psRoot->p2 ) {
  42.         return Test( nValue, psRoot->p2 );
  43.  }
  44.  psRoot->p2 = new Snode;
  45.  if ( NULL ==  psRoot->p2 ) {
  46.      return false;
  47.          }
  48.  psRoot->p2->p1 = NULL;
  49.  psRoot->p2->p2 = NULL;
  50.  psRoot->p2->nValue = nValue;
  51.  return true;
  52.     }
  53. }
  54.  
  55. Joanna Szczesniak: Q4. Given a C String, can you describe how to flip the word from
  56. “Hello”               => “olleH”
  57. “Maintenance”   => “ecnanetniaM”
  58.  
  59. Joanna Szczesniak: Q5. If you do not have memory space to allocate any array and unable to use any function calls, how would you do it? Try to manipulate from the input string buffer.
  60.  
  61. Joanna Szczesniak: Q6. Can you think of an algorithm that performs the below:
  62. “The Big Brown Fox”        => “Fox Brown Big The”
  63. “How are you?”   => “you? are How”
  64.  
  65. Joanna Szczesniak: Q7. If you also do not have memory space to perform the above, how would you do it?
  66.  
  67. Joanna Szczesniak: Q8. Here’s a hint, what happens when you use the sentence to be processed by the previous question’s function?
  68.  
  69.  
  70.