Computer Science Canada Deleting in Linked List |
Author: | imbored [ Sat Jan 02, 2010 7:47 pm ] | ||
Post subject: | Deleting in Linked List | ||
What is it you are trying to achieve? Having a procedure delete a value from the linked list... also make it a circular linked list. What is the problem you are having? I understand the box things [....|...] [XXXX] [....|...] ..|_______________^ etc... but i dont understand how to program it. Describe what you have tried to solve this problem i tried replacing the value that needs to be deleted with the next value and it keeps going untill the end.. but it didnt end up great either i programmed it wrong or its just wrong... i started from scratch from what i had before. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) this is what i got.. it saves the inputs into the linked list and outputs it. it is choppy and inefficient... but i dont really know how to make it more efficient. but first thing is first how to make it delete o.o''
Please specify what version of Turing you are using 4.1.1 |
Author: | [Gandalf] [ Sun Jan 03, 2010 2:10 pm ] |
Post subject: | RE:Deleting in Linked List |
Well first thing's first, have you investigated this problem yourself? Linked lists are very common, and there are plenty of resources on just about anything to do with them. Here's a quick link from Google which might help on delete: http://www.cs.bu.edu/teaching/cs112/spring-2000/linked-list-delete/ This is a great way to learn/practice recursion, so try to follow that route. Just go slowly, case-by-case, and ensure that each piece of code you write is accurate. |
Author: | imbored [ Sun Jan 03, 2010 3:31 pm ] |
Post subject: | RE:Deleting in Linked List |
yea i saw that before but i dont know how to program it... i dont get the C++ codes |
Author: | [Gandalf] [ Sun Jan 03, 2010 4:33 pm ] |
Post subject: | RE:Deleting in Linked List |
Perhaps try the following site instead, particularly the "modifying lists" section. It may even "convert" you to Python, given that Turing is a very ugly language in which to write linked lists. ![]() http://ada.rg16.asn-wien.ac.at/~python/how2think/english/chap17.htm Try to generalize what they do for the 2nd element of a linked list to an arbitrary element. I'm sure you can find something to clarify the concept. If you have any specific questions, you can then post them here. |
Author: | imbored [ Sun Jan 03, 2010 4:49 pm ] |
Post subject: | RE:Deleting in Linked List |
this site is better but reguarding the converting... i can't do that. This is part of an assignment. i was suppose to use pascal but it wasn't working on my computer so i used turing which is already on my computer. Though this site looks alot more helpful i really dont fully understand it. I dont understand how to shift the pointer because i dont fully understand the functions regarding the pointer. edit : okay nvm.. i read it a few times... and i dont get it lol. |