Simple implementation of data structures for python
Project description
fds
Simple implementaion of data structures (DS) for python
Content
- linked list
- stack
- queue
Classes
- List // linked list
- DList // doubly linked list
- Stack // stack
- Queue // queue
API
List
- insert(self, data, pos=0) // TODO: add node in the entered position (pos=0 => add in the begining)
- append(self, data) // TODO: add node in the end
- delete(self, data) // TODO: delete all nodes hav the entered data
- remove(self, pos=0) // TODO: return and remove node in the entered position (pos=0 => remove first node, pos=-1 => remove last node)
- first(self) // TODO: return the data in the first node
- last(self) // TODO: return the data in the last node
DList
- add_begin(self, data) // TODO: add a node to the begin
- add_fin(self, data) // TODO: add a node to the fin
Stack
- push(self, data) // TODO: add a node to the top
- pop(self) // TODO: return and remove the node in the top
- top(self) // TODO: return the data in the first node
Queue
- enqueue(self, data) // TODO: add a node to the end
- dequeue(self) // TODO: return and remove the first element
- front(self) // TODO: return the data in the first node
- back(self) // TODO: return the data in the last node
API for all DSs
- str(self) // USE: print([DS_name]) // TODO: display the DS
- len(self) // USE: len([DS_name]) // TODO: return the lenth of the DS
- empty(self) // TODO: return True if the DS is empty
- clear(self) // TODO: clear the DS
- find(self, data) // TODO: return the number of how many the entered data found in the DS
- reverse(self) // TODO: return the reverse of the DS
- exchange(self, n) // TODO: circular permutation for n time
classmethods for all DSs
// USE: [DS] = [DS_type].method([DS1], [DS2])
// Examples:
>>> stck3 = Stack.merge(stck1, stck2)
>>> Stack.swap([DS1], [DS2])
the tow DS parameters must be from the same DS
- merge(cls, DS1, DS2) // TODO: return the merge of two DS in new DS
- swap(cls, DS1, DS2) // TODO: swap between DS1 and DS2 (DS1 will be DS2 and DS2 will be DS1)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-fds-2.0.0b2.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file py-fds-2.0.0b2.tar.gz
.
File metadata
- Download URL: py-fds-2.0.0b2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ae765c69f4eaf715d4474763b4becfbe13ba3c1e95eccbc50bd26a7619c0618 |
|
MD5 | 2bb672e2211934997a8d4f4cbf624070 |
|
BLAKE2b-256 | d2722a8779b315dfb6571b9538693aa869fcab7e860c578f36bb1d4a8a1f439d |
File details
Details for the file py_fds-2.0.0b2-py3-none-any.whl
.
File metadata
- Download URL: py_fds-2.0.0b2-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2672c24708875cc5bf7cd00462d2a4e472b321de065384a4aa90221a6cbbab65 |
|
MD5 | 9a0fa8ef6ae4e53fb0045b89ab60fe7a |
|
BLAKE2b-256 | 76012b6249572d8bb9d399a0baa08534a8f902843d4fe165e276e92928090288 |