Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1.  
  2.  
  3. QuantumPrimus - Today at 9:32 AM
  4. Just
  5. ...
  6. Choatic Adventures - Today at 9:32 AM
  7. if dad.is_perv then
  8. me.run
  9. else
  10. me.dies
  11. QuantumPrimus - Today at 9:32 AM
  12. Buy a good laptop or build your own computer
  13. PhobicHD - Today at 9:32 AM
  14. yeah thats good
  15. sneaky_squirrel - Today at 9:32 AM
  16. I can't draw on laptops...
  17. PhobicHD - Today at 9:32 AM
  18. just remember the indentation so my old eyes can see
  19. QuantumPrimus - Today at 9:32 AM
  20. Yea you can
  21. Choatic Adventures - Today at 9:32 AM
  22. lol
  23. sneaky_squirrel - Today at 9:33 AM
  24. You can only draw on Surface Pro.
  25. QuantumPrimus - Today at 9:33 AM
  26. Nope
  27. PhobicHD - Today at 9:33 AM
  28. @Choatic Adventures you wanna take this to begginers 2
  29. sneaky_squirrel - Today at 9:33 AM
  30. everything else is too expensive.
  31. QuantumPrimus - Today at 9:33 AM
  32. Tablets bud
  33. Choatic Adventures - Today at 9:33 AM
  34. sure
  35. QuantumPrimus - Today at 9:33 AM
  36. Sorry guys
  37. sneaky_squirrel - Today at 9:33 AM
  38. I left my turd in beginners 2
  39. :frowning:
  40. QuantumPrimus - Today at 9:33 AM
  41. Didnt mean to turn this to something else
  42. sneaky_squirrel - Today at 9:33 AM
  43. Oh well.
  44. Should I print my algorithm here?
  45. It's a function with 3 exception cases and an if/else nested inside another if/else
  46. Maybe I should just post it in advanced channel.(edited)
  47. Pabs3 - Today at 9:35 AM
  48. Is there a function to convert a binary string to a decimal?
  49. sneaky_squirrel - Today at 9:36 AM
  50. I guess there technically is. Is your string of type string?
  51. Pabs3 - Today at 9:36 AM
  52. yeah
  53. sneaky_squirrel - Today at 9:36 AM
  54. You should loop through your string.
  55. Start at the end of the char array (string), so like you_string[ you_string.size( ) - 1 ]
  56. This last character will be multiplied times 2 to the zero'd power
  57. It's a bit of a mess to explain. My mind is a mess :frowning:(edited)
  58. Pabs3 - Today at 9:40 AM
  59. I got it! thanks!
  60. sneaky_squirrel - Today at 9:40 AM
  61. Good luck Pabs3
  62. Murzinio++ - Today at 9:43 AM
  63. I look into the channel and first thing I see is string_squirrel talking about strings. :thonk~2:
  64. Pabs3 - Today at 9:44 AM
  65. wait, so 1010 should be converted to 10 but I get 96
  66. sneaky_squirrel - Today at 9:45 AM
  67. Hello Murzinio.
  68. The Grim Reaper, deadline, slowly approaches me.
  69. And I am unable to move.
  70. I'm walking into a transparent glass. I can't get through, but have no idea why.
  71. Murzinio++ - Today at 9:47 AM
  72. :thonk~2:
  73. sneaky_squirrel - Today at 9:47 AM
  74. If only my algorithm were flawed, I would have something I could do.. But its perfect and it dumps core.
  75. TreeNode * TreeNode::remove( string k, TreeNode * t )
  76. {
  77. cout << "removing " << k << endl;
  78. if( t == nullptr ){ return nullptr; }
  79.  
  80. TreeNode * u = find( k, t );
  81. if( u == nullptr ){ return t; }
  82.  
  83. if( t->left == nullptr && t->right == nullptr )
  84. {
  85. if( k == t->key)
  86. {
  87. delete t;
  88. return nullptr;
  89. }
  90. }
  91.  
  92. if( u->left == nullptr )
  93. {
  94. if( u->right == nullptr )
  95. {
  96. TreeNode * v = find_parent( k, t );
  97. if( v->left->key == u->key )
  98. {
  99. v->left = nullptr;
  100. }
  101. else
  102. {
  103. v->right = nullptr;
  104. }
  105. delete_node( u );
  106. return t;
  107. }
  108. else
  109. {
  110. TreeNode * v = find_parent( k, t );
  111. if( v->left->key == u->key )
  112. {
  113. v->left = u->right;
  114. }
  115. else
  116. {
  117. v->right = u->right;
  118. }
  119. delete_node( u );
  120. return t;
  121. }
  122. }
  123. else
  124. {
  125. if( u->right == nullptr )
  126. {
  127. TreeNode * v = find_parent( k, t );
  128. if( v->left->key == u->key )
  129. {
  130. v->left = u->left;
  131. }
  132. else
  133. {
  134. v->right = u->left;
  135. }
  136. delete_node( u );
  137. return t;
  138. }
  139. else
  140. {
  141. TreeNode * v = find_parent_previous( t );
  142. TreeNode * w = v->right;
  143. swap( u, w );
  144. if( v->key == w->key )
  145. {
  146. v->left = w->right;
  147. }
  148. else
  149. {
  150. v->right = w->right;
  151. }
  152. //delete_node( w );
  153. return t;
  154. }
  155. }
  156. return t;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement