Re: [Tutor] =Linked List Using Map

2015-04-19 Thread Alan Gauld
On 19/04/15 16:25, niyanax...@gmail.com wrote: May you take a look and let me know what needs to be changed? Thank you in advance. The node code looks OK. class Map: Read through your init method, remembering that it only gets calledv once when the Map is created. def __init__(

Re: [Tutor] =Linked List Using Map

2015-04-19 Thread niyanaxx95
Thank You Steven for your great help You really helped me to understand my assignment more as well as what maps and linked lists are. I used your guidance and came up with my full code. May you take a look and let me know what needs to be changed? Thank you in advance. class Node:

Re: [Tutor] =Linked List Using Map

2015-04-18 Thread Steven D'Aprano
Hello Ni'Yana, and welcome! On Fri, Apr 17, 2015 at 06:11:00PM +, niyanax...@gmail.com wrote: > Hello I need guidance trying to solve my assignment. I am completely > lost when using maps with linked lists. I understand linked lists > though. May someone work with me? We will not do your h

Re: [Tutor] =Linked List Using Map

2015-04-18 Thread Joel Goldstick
> > > I hate when teachers ask students to do stupid stuff like this. > It encourages so many bad practices it's positively dangerous! > If they must have them reinvent the wheel at least let them > use the native Python list to do it! > > I suspect that the instructor is using Python as a second

Re: [Tutor] =Linked List Using Map

2015-04-17 Thread Alan Gauld
On 17/04/15 19:11, niyanax...@gmail.com wrote: Hello I need guidance trying to solve my assignment. > I am completely lost when using maps with linked lists. > I understand linked lists though. Unfortunately we do not. Linked lists aren't really a native Python type and maps are a native type

[Tutor] =Linked List Using Map

2015-04-17 Thread niyanaxx95
Sent from Windows Mail From: Ni'Yana Morgan Sent: ‎Friday‎, ‎April‎ ‎17‎, ‎2015 ‎2‎:‎06‎ ‎PM To: tut...@python.org Hello I need guidance trying to solve my assignment. I am completely lost when using maps with linked lists. I understand linked lists though. May someone work with

Re: [Tutor] linked list with cycle structure

2009-01-08 Thread David Hláčik
Hi, well i am able to find a loop in a list using two iterators.One iterator runs "two times faster than the other", and if he encounters the first, it means that there is a loop. Example : 1,2,3,4,5,6,7,8,9,5 the algorithm would generate: start - 1,2 iteration 1- 2, 4 iteration 2- 3, 6 iteratio

Re: [Tutor] linked list with cycle structure

2009-01-07 Thread Robert Kern
Terry Reedy wrote: David Hláčik wrote: But what if i have another condition , and that is *i can use only helping memory with constant size* ? This means i am not able to create any set and adding elements there. I need to have a constant size variables . This is complication a complication for

Re: [Tutor] linked list with cycle structure

2009-01-07 Thread David Hláčik
Hi, so okay, i will create a helping set, where i will be adding elements ID, when element ID will be allready in my helping set i will stop and count number of elements in helping set. This is how long my cycled linked list is. But what if i have another condition , and that is *i can use only h

Re: [Tutor] linked list with cycle structure

2009-01-07 Thread Kent Johnson
On Wed, Jan 7, 2009 at 5:59 AM, David Hláčik wrote: > Hello guys, > > I have a linked list where *number of elements is unlimited* and > **last element points on random (can be first, last, in middle , > anywhere) element within linked list** - this is important . My goals > is to create an archit

Re: [Tutor] linked list with cycle structure

2009-01-07 Thread A.T.Hofkamp
David Hláčik wrote: Hello guys, I have a linked list where *number of elements is unlimited* and **last element points on random (can be first, last, in middle , anywhere) element within linked list** - this is important . My goals is to create an architecture /scheme for **algoritmus which will

[Tutor] linked list with cycle structure

2009-01-07 Thread David Hláčik
Hello guys, I have a linked list where *number of elements is unlimited* and **last element points on random (can be first, last, in middle , anywhere) element within linked list** - this is important . My goals is to create an architecture /scheme for **algoritmus which will count total number of

Re: [Tutor] Linked List

2005-03-06 Thread Danny Yoo
> > >>> myls=range(50) > > >>> for i in myls: > > print i > > if i==20: > > myls.insert(5,5) > > > > The point is, the list(both size and elements) is > > changing even as it is being operated upon. > > My first thought was to say, "Use a queue.Queue." But it appe

Re: [Tutor] Linked List

2005-03-06 Thread John Fouhy
Jeff Shannon wrote: You might want to check the Cookbook to see if there's a priority queue recipe there. If not, I suspect that Google can be convinced to yield something... From the bisect module docs: import Queue, bisect class PriorityQueue(Queue.Queue): def _put(self, item): bisec

Re: [Tutor] Linked List

2005-03-06 Thread Jeff Shannon
On Sat, 5 Mar 2005 06:20:40 -0800 (PST), Shitiz Bansal <[EMAIL PROTECTED]> wrote: > In order to explain wat my problem is, here is an > example code. Its not exactly what I am doing, I am > using multiple threads and a rather complicated code > so try and understand the sense rather than the code

Re: [Tutor] Linked List

2005-03-05 Thread Kent Johnson
Stéphane Brunet wrote: Kent Johnson wrote: What Jacob is saying is, one common way to deal with this is to make a copy of the list and iterate over that while changing the original list. Your sample would look like this: Hi, And what if the list is *really* big ? Don't you loose much speed/memor

Re: [Tutor] Linked List

2005-03-05 Thread Alan Gauld
> >>> myls=range(50) > >>> for i in myls: > print i > if i==20: > myls.insert(5,5) > > The point is, the list(both size and elements) is > changing even as it is being operated upon. You are quite right it is, in general a bad idea to alter the thing you are iterating over. > This particular ca

Re: [Tutor] Linked List

2005-03-05 Thread =?ISO-8859-1?Q?St=E9phane_Brunet?=
Kent Johnson wrote: What Jacob is saying is, one common way to deal with this is to make a copy of the list and iterate over that while changing the original list. Your sample would look like this: Hi, And what if the list is *really* big ? Don't you loose much speed/memory while making a copy ?

Re: [Tutor] Linked List

2005-03-05 Thread Shitiz Bansal
Got ya, it doesnt however help in my case as inside the for loop also i intend to change the list elements. --- Kent Johnson <[EMAIL PROTECTED]> wrote: > Shitiz Bansal wrote: > > I could not understand what you exactly mean. > > > > In order to explain wat my problem is, here is an > > example c

Re: [Tutor] Linked List

2005-03-05 Thread Kent Johnson
Shitiz Bansal wrote: I could not understand what you exactly mean. In order to explain wat my problem is, here is an example code. Its not exactly what I am doing, I am using multiple threads and a rather complicated code so try and understand the sense rather than the code itself. myls=range(50)

Re: [Tutor] Linked List

2005-03-05 Thread Shitiz Bansal
I could not understand what you exactly mean. In order to explain wat my problem is, here is an example code. Its not exactly what I am doing, I am using multiple threads and a rather complicated code so try and understand the sense rather than the code itself. >>> myls=range(50) >>> for i in my

Re: [Tutor] Linked List

2005-03-04 Thread Jacob S.
I'm taking a shot in the dark and answering here. Have you tried making a copy of the list, iterating over the copy, and changing the original based on the copy? Jacob Hi, Any body has any idea on how to implement a linked list in python? Ordinary python lists are not quite the same. what i need

[Tutor] Linked List

2005-03-04 Thread Shitiz Bansal
Hi, Any body has any idea on how to implement a linked list in python? Ordinary python lists are not quite the same. what i need is a list i can traverse through sequentially without bothering about the indices, as another process is continuously editing this list, by inserting and deleting elemen