Thanks axon and mystic_skies..
but they don't expect me to memorize everything i've been into , do they?
Thanks axon and mystic_skies..
but they don't expect me to memorize everything i've been into , do they?
My Tutorials :
- Bad programming practices in : C
- C\C++ Tips
(constrcutive criticism is very welcome)
- Brain Cell
do they want you to actually delete that node, or just write a code that would give the effect that the mentioned node has been removed?? the latter is simple enough, i am not too sure if actual deletion of the node can be done with the limited info. is it possible to delete it ??Here's one from an interview I had:
Given a node in a singly linked list, with no other knowledge of the list (i.e. not knowing the head), how would you remove that node?
Code:>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.
When you apply for a job, chances are that about hundred other people applied as well. The most important part is the job interview. However, no one will interview a hundred people. First, people will sort out the 10 most likely candidates. This will be done by looking at your resume & cv. Priority here is knowledge of the stuff they work with. Obviously, 2 years Oracle is better than 3 years MS-SQL if the employer is using Oracle. Then there are things in the cv that don't fit the image people have of their future employee. If you have to sort out 90% to keep it managable, you take every reason you can get. I have sorted out resumes for the sole fact that those people had a german D equivalent in Maths 8 years ago in school.For all those who applied for a programming job :
Which would help you most to get the job : your personal portfolio , your experience (like worked with few APIs\systems ..etc) or the job interview?
So all parts are important, each in another step of the screening.
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.
@Ping: The code just has to appear to remove the node from the list. As long as the list is without that node afterwards, and there aren't any memory leaks, it's all good.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
Damnit XSquared!!! Now you gave me something to try
I'd have to say the answer is no. You cannot put a class back together again, no matter how good a reverse engineer you are.- Can we generate a C++ source code from the binary file?
Yes and no. You can disassemble a binary file and then try to convert it to C++. However with optimization it most likely will not look anything like your orginal code. Also variable names will be lost.
I want to know the answer, too. And it'd better be some smart solution, not just a joke.Originally Posted by PING
source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense
The way I did it; copy the data from next node to the current (first loop this will be the node that should be "deleted") node, set current node to be next. Repeat unitil you reach the end node, then pop that endnode.
Last edited by Shakti; 02-26-2005 at 01:48 AM.
Along the same idea as Shakti:
Node C = current Node
Node N = next Node
Node X = N->next
Copy the data part from N to C. Get address of X. Delete N, set C->next = X
Ah yah, that was a little better and little faster than mine
Well in all fairness I didn't have an answer until I saw your post and then just saw a faster way
Now the real question becomes: If you are at the tail can you delete the Node?
> Now the real question becomes: If you are at the tail can you delete the Node?
Damn, beaten to the obvious question now
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Yes , if you design it for it to be possible
Last edited by Shakti; 02-26-2005 at 11:13 AM.
Well we know the design is poor because
1) its a single link
2) You can get to the head
Sorry, left something out in my initial problem statement. It's a circular singly linked list.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie