Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QuantumPrimus - Today at 9:32 AM
- Just
- ...
- Choatic Adventures - Today at 9:32 AM
- if dad.is_perv then
- me.run
- else
- me.dies
- QuantumPrimus - Today at 9:32 AM
- Buy a good laptop or build your own computer
- PhobicHD - Today at 9:32 AM
- yeah thats good
- sneaky_squirrel - Today at 9:32 AM
- I can't draw on laptops...
- PhobicHD - Today at 9:32 AM
- just remember the indentation so my old eyes can see
- QuantumPrimus - Today at 9:32 AM
- Yea you can
- Choatic Adventures - Today at 9:32 AM
- lol
- sneaky_squirrel - Today at 9:33 AM
- You can only draw on Surface Pro.
- QuantumPrimus - Today at 9:33 AM
- Nope
- PhobicHD - Today at 9:33 AM
- @Choatic Adventures you wanna take this to begginers 2
- sneaky_squirrel - Today at 9:33 AM
- everything else is too expensive.
- QuantumPrimus - Today at 9:33 AM
- Tablets bud
- Choatic Adventures - Today at 9:33 AM
- sure
- QuantumPrimus - Today at 9:33 AM
- Sorry guys
- sneaky_squirrel - Today at 9:33 AM
- I left my turd in beginners 2
- :frowning:
- QuantumPrimus - Today at 9:33 AM
- Didnt mean to turn this to something else
- sneaky_squirrel - Today at 9:33 AM
- Oh well.
- Should I print my algorithm here?
- It's a function with 3 exception cases and an if/else nested inside another if/else
- Maybe I should just post it in advanced channel.(edited)
- Pabs3 - Today at 9:35 AM
- Is there a function to convert a binary string to a decimal?
- sneaky_squirrel - Today at 9:36 AM
- I guess there technically is. Is your string of type string?
- Pabs3 - Today at 9:36 AM
- yeah
- sneaky_squirrel - Today at 9:36 AM
- You should loop through your string.
- Start at the end of the char array (string), so like you_string[ you_string.size( ) - 1 ]
- This last character will be multiplied times 2 to the zero'd power
- It's a bit of a mess to explain. My mind is a mess :frowning:(edited)
- Pabs3 - Today at 9:40 AM
- I got it! thanks!
- sneaky_squirrel - Today at 9:40 AM
- Good luck Pabs3
- Murzinio++ - Today at 9:43 AM
- I look into the channel and first thing I see is string_squirrel talking about strings. :thonk~2:
- Pabs3 - Today at 9:44 AM
- wait, so 1010 should be converted to 10 but I get 96
- sneaky_squirrel - Today at 9:45 AM
- Hello Murzinio.
- The Grim Reaper, deadline, slowly approaches me.
- And I am unable to move.
- I'm walking into a transparent glass. I can't get through, but have no idea why.
- Murzinio++ - Today at 9:47 AM
- :thonk~2:
- sneaky_squirrel - Today at 9:47 AM
- If only my algorithm were flawed, I would have something I could do.. But its perfect and it dumps core.
- TreeNode * TreeNode::remove( string k, TreeNode * t )
- {
- cout << "removing " << k << endl;
- if( t == nullptr ){ return nullptr; }
- TreeNode * u = find( k, t );
- if( u == nullptr ){ return t; }
- if( t->left == nullptr && t->right == nullptr )
- {
- if( k == t->key)
- {
- delete t;
- return nullptr;
- }
- }
- if( u->left == nullptr )
- {
- if( u->right == nullptr )
- {
- TreeNode * v = find_parent( k, t );
- if( v->left->key == u->key )
- {
- v->left = nullptr;
- }
- else
- {
- v->right = nullptr;
- }
- delete_node( u );
- return t;
- }
- else
- {
- TreeNode * v = find_parent( k, t );
- if( v->left->key == u->key )
- {
- v->left = u->right;
- }
- else
- {
- v->right = u->right;
- }
- delete_node( u );
- return t;
- }
- }
- else
- {
- if( u->right == nullptr )
- {
- TreeNode * v = find_parent( k, t );
- if( v->left->key == u->key )
- {
- v->left = u->left;
- }
- else
- {
- v->right = u->left;
- }
- delete_node( u );
- return t;
- }
- else
- {
- TreeNode * v = find_parent_previous( t );
- TreeNode * w = v->right;
- swap( u, w );
- if( v->key == w->key )
- {
- v->left = w->right;
- }
- else
- {
- v->right = w->right;
- }
- //delete_node( w );
- return t;
- }
- }
- return t;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement