Package: py-fds
pyfdsSimple implementation of data structures(DS)for python.This package no more supported and will not get new updates, seePyAlStructfor new implementation of algorithms and data structures.Content of the librarylinked listdoubly linked listsorted linked liststackqueuepriority queuebinary search treeutils// (package)Content of utilsnode // single pointer nodednode // double pointer nodetnode // tree pointer nodepairhow to import utilsfrom pyfds.utils import *pair = Pair()orimport pyfds.utilspair = utils.Pair()ClassesList // linked listDList // doubly linked listSList // sorted linked listStack // stackQueue // queuePQueue // priority queueBST // binary search treeAPIListPropertiesfirst // TODO: return the data in the first nodelast // TODO: return the data in the last nodeMethodesinsert(data, pos) // TODO: add node in the entered position (pos=0 => add in the begining) // the default value is set to 0append(data) // TODO: add node in the enddelete(data) // TODO: delete all nodes hav the entered dataremove(pos=0) // TODO: return and remove node in the entered position (pos=0 => remove first node, pos=-1 => remove last node)DListPropertiesfirst // TODO: return the data in the first nodelast // TODO: return the data in the last nodeMethodesadd_begin(data) // TODO: add a node to the beginadd_fin(data) // TODO: add a node to the findelete(data) // TODO: delete all nodes hav the entered dataremove(pos) // TODO: return and remove node in the entered position (pos=0 => remove first node, pos=-1 => remove last node) // the default value is set to 0SListPropertiesfirst // TODO: return the data in the first nodelast // TODO: return the data in the last nodeMethodesappend(data) // TODO: add a node to the list in a sorted waydelete(data) // TODO: delete all nodes hav the entered dataremove(pos) // TODO: return and remove node in the entered position (pos=0 => remove first node, pos=-1 => remove last node) // the default value is set to 0StackPropertiestop // TODO: return the data in the first nodeMethodespush(data) // TODO: add a node to the toppop() // TODO: return and remove the node in the topQueuePropertiesfront // TODO: return the data in the first nodeback // TODO: return the data in the last nodeMethodsenqueue(data) // TODO: add a node to the enddequeue() // TODO: return and remove the first elementPQueuePropertiesfront // TODO: return the data in the first nodeback // TODO: return the data in the last nodeMethodsenqueue(data) // TODO: add a node to the queue in a sorted waydequeue() // TODO: return and remove the first elementmethods for all DSsstr() // USE: print([DS_name]) // TODO: display theDSlen() // USE: len([DS_name]) // TODO: return the lenth of theDSempty() // TODO: return True if theDSis emptyclear() // TODO: clear theDSfind(data) // TODO: return the number of how many the entered data found in theDSreverse() // TODO: return the reverse of theDSsort() // TODO: sort theDSif its not sortedexchange(n) // TODO: circular permutation for n timeequals(DS) // TODO: return True ifDSis equal tothis DSclassmethods 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 DSmerge(DS1, DS2) // TODO: return the merge of twoDSsin newDSswap(DS1, DS2) // TODO: swap between DS1 and DS2 (DS1will beDS2andDS2will beDS1)Note :(reverse, sort, exchange) are not supported in thisDSbecause they brake the rule of theSorted Linked ListBSTpropertiesnumber_of_nodes // TODO: return the number of nodes in theBSTnumber_of_liefs // TODO: return the number of liefs (nodes without any children) in theBSTheight // TODO: return the height of theBSTmax // TODO: return the maximum value in theBSTmin // TODO: return the minimum value in theBSTmethodespre_order() // TODO: represent theBSTin pre_order wayin_order() // TODO: represent theBSTin in_order waypost_order() // TODO: represent theBSTin post_order wayappend(data) // TODO: append a new node to theBSTif not existfind(data) // TODO: search for an element in theBSTand return it if existparent(data) // TODO: return the parent node of an element if existsuccessor(data) // TODO: return the next value in theBSTif existpredecessor(data) // TODO: return the previous value in theBSTif existdelete(data) // TODO: delete an element from theBSTif existequals(bst) // TODO: return True ifbstis equal tothis BST(this BSTis the  same asbst)