Re: Data structure and algorithms

2007-01-29 Thread Beej
On Jan 29, 10:15 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > The instructor learned his lesson: no more assignments > done in "any language I can understand" Without naming names, there was a person at my university who gained a certain amount of notoriety by implementing a file system fo

Re: Data structure and algorithms

2007-01-29 Thread Beej
On Jan 29, 1:50 pm, "azrael" <[EMAIL PROTECTED]> wrote: > thanks guys. i see that there is no way then to go back to C to > satisfy my prof and get a grade Seconding what Dennis says below, it is totally possible to use Python for this. I didn't mean to discourage you from using Python--I just w

Re: Data structure and algorithms

2007-01-29 Thread azrael
thanks guys. i see that there is no way then to go back to C to satisfy my prof and get a grade -- http://mail.python.org/mailman/listinfo/python-list

Re: Data structure and algorithms

2007-01-29 Thread Beej
On Jan 28, 2:56 pm, "azrael" <[EMAIL PROTECTED]> wrote: > class Node: > def __init__(self, cargo=None, next=None): > self.cargo = cargo > self.next = next This is OK for the node itself, but maybe you should try writing a LinkedList class that you use: class LinkedList(object): de

Re: Data structure and algorithms

2007-01-29 Thread Steve Holden
Terry Reedy wrote: > "azrael" <[EMAIL PROTECTED]> wrote in message [...] > | > | but this was not dinamicly enough for me (or my prof.) so > > dynamic? I have no idea what you mean by 'not dynamic enough'. > > Python is not C or C++. It does not have pointers. Trying to program in C > in Pyt

Re: Data structure and algorithms

2007-01-28 Thread Diez B. Roggisch
azrael schrieb: > i'd like to get more control like in c with pointers. I want to loose > the data after disabling: > list=[] list.append(Node(1)) list.append(Node(2)) list[0].next=list[1] > > > 1, 2 > > list.append(Node(3)) list[1].next=list[2] > > > 1,2

Re: Data structure and algorithms

2007-01-28 Thread Terry Reedy
"azrael" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hy, i am a student and in 2 days I am writing a test in data | structures and algorithms. I've done my homework and understood all | the implementations and structures. My profesor was so kind to allow | us to use any programi

Re: Data structure and algorithms

2007-01-28 Thread azrael
i'd like to get more control like in c with pointers. I want to loose the data after disabling: >>> list=[] >>> list.append(Node(1)) >>> list.append(Node(2)) >>> list[0].next=list[1] 1, 2 >>> list.append(Node(3)) >>> list[1].next=list[2] 1,2,3 >>> list[0].next=list[2] 1,3

Re: Data structure and algorithms

2007-01-28 Thread Jonathan Curran
What are you trying to make in the first place? A singly linked list? If so google is littered with examples of linked lists done in python. A simple search for 'python linked list' brings up many results. Btw, for future reference, no need for apologetics (the second post). - Jonathan -- http

Re: Data structure and algorithms

2007-01-28 Thread azrael
I'm not a kid who heard that Python is simple, so he wants to use it and throw it away. I discovered it about 2 months ago, and I learnt it better then c in 2 years. I want to use python for this test because i love it. I am amazed about what i can do i such little time. My god, I even printed