Balanced Parentheses Check | Python

Problem :  Given a string of opening and closing parentheses, check whether it’s balanced. We have 3 types of parentheses: round brackets: (), square brackets: [], and curly brackets: {}. Assume that the string doesn’t contain any other character than these, no spaces words or numbers. As a reminder, balanced parentheses require every opening parenthesis … More Balanced Parentheses Check | Python

Recursive Binary Search | Python

Implement recursive binary search in Python def recursive_binary_search(arr,ele): if len(arr) == 0: return False else: mid = len(arr)/2 if arr[mid] == ele: return True else: if ele < arr[mid]: return recursive_binary_search(arr[:mid], ele) else: return recursive_binary_search(arr[mid+1:], ele) d = recursive_binary_search([1,2,3,4,5],22) print d

Doubly Linked List | Python

Implementation of Doubly Linked List in Python class DoublyLinkedList(object): def __init__(self,val): self.value = val self.next_node = None self.prev_node = None a = DoublyLinkedList(1) b = DoublyLinkedList(2) c = DoublyLinkedList(3) a.next_node = b b.prev_node = a b.next_node = c c.prev_node = b