mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Fixes black failures from Previous PR (#1751)
* Fixes black failures from Previous PR * Fixes equality testing alert * Fixes call to main() alert * Fixes unused import
This commit is contained in:
parent
f0dfc4f46d
commit
4866b1330b
@ -56,13 +56,13 @@ class BinarySearchTree:
|
|||||||
parent_node = self.root # from root
|
parent_node = self.root # from root
|
||||||
while True: # While we don't get to a leaf
|
while True: # While we don't get to a leaf
|
||||||
if value < parent_node.value: # We go left
|
if value < parent_node.value: # We go left
|
||||||
if parent_node.left == None:
|
if parent_node.left is None:
|
||||||
parent_node.left = new_node # We insert the new node in a leaf
|
parent_node.left = new_node # We insert the new node in a leaf
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
parent_node = parent_node.left
|
parent_node = parent_node.left
|
||||||
else:
|
else:
|
||||||
if parent_node.right == None:
|
if parent_node.right is None:
|
||||||
parent_node.right = new_node
|
parent_node.right = new_node
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -24,6 +24,7 @@ from random import randint
|
|||||||
|
|
||||||
class Node:
|
class Node:
|
||||||
"""Binary Search Tree Node"""
|
"""Binary Search Tree Node"""
|
||||||
|
|
||||||
def __init__(self, key, freq):
|
def __init__(self, key, freq):
|
||||||
self.key = key
|
self.key = key
|
||||||
self.freq = freq
|
self.freq = freq
|
||||||
|
@ -140,7 +140,7 @@ def emitterConverter(sizePar, data):
|
|||||||
# Mount the message
|
# Mount the message
|
||||||
ContBP = 0 # parity bit counter
|
ContBP = 0 # parity bit counter
|
||||||
for x in range(0, sizePar + len(data)):
|
for x in range(0, sizePar + len(data)):
|
||||||
if dataOrd[x] == None:
|
if dataOrd[x] is None:
|
||||||
dataOut.append(str(parity[ContBP]))
|
dataOut.append(str(parity[ContBP]))
|
||||||
ContBP += 1
|
ContBP += 1
|
||||||
else:
|
else:
|
||||||
@ -243,7 +243,7 @@ def receptorConverter(sizePar, data):
|
|||||||
# Mount the message
|
# Mount the message
|
||||||
ContBP = 0 # Parity bit counter
|
ContBP = 0 # Parity bit counter
|
||||||
for x in range(0, sizePar + len(dataOutput)):
|
for x in range(0, sizePar + len(dataOutput)):
|
||||||
if dataOrd[x] == None:
|
if dataOrd[x] is None:
|
||||||
dataOut.append(str(parity[ContBP]))
|
dataOut.append(str(parity[ContBP]))
|
||||||
ContBP += 1
|
ContBP += 1
|
||||||
else:
|
else:
|
||||||
|
@ -6,6 +6,8 @@ Find root of function in interval [a, b] (Or find a value of x such that f(x) is
|
|||||||
|
|
||||||
https://en.wikipedia.org/wiki/Bisection_method
|
https://en.wikipedia.org/wiki/Bisection_method
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def equation(x: float) -> float:
|
def equation(x: float) -> float:
|
||||||
"""
|
"""
|
||||||
>>> equation(5)
|
>>> equation(5)
|
||||||
|
@ -25,7 +25,6 @@ e.g. python tabu_search.py -f tabudata2.txt -i 4 -s 3
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def generate_neighbours(path):
|
def generate_neighbours(path):
|
||||||
@ -278,4 +277,4 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Pass the arguments to main method
|
# Pass the arguments to main method
|
||||||
sys.exit(main(parser.parse_args()))
|
main(parser.parse_args())
|
||||||
|
@ -47,7 +47,7 @@ class Automaton:
|
|||||||
q.append(child)
|
q.append(child)
|
||||||
state = self.adlist[r]["fail_state"]
|
state = self.adlist[r]["fail_state"]
|
||||||
while (
|
while (
|
||||||
self.find_next_state(state, self.adlist[child]["value"]) == None
|
self.find_next_state(state, self.adlist[child]["value"]) is None
|
||||||
and state != 0
|
and state != 0
|
||||||
):
|
):
|
||||||
state = self.adlist[state]["fail_state"]
|
state = self.adlist[state]["fail_state"]
|
||||||
|
Loading…
Reference in New Issue
Block a user