Skip to content
Advertisement

Tag: recursion

How to implement AVL tree rotation?

I have coded an AVL Tree and my logic for the rotations is correct but I am still not able to get it working properly. For rotations on the root node my rotations work properly but if the rotation is further down the tree, the parent node does not point to the new node that has been rotated into place

Using Recursion to check for sum of tuples in a list

I have a func which takes a list of tuples, each tuple contains two items: item name and value. I need the func to return True if it’s possible to divide the tuple list into two equal valued groups and False otherwise. The function should be recursive and should not use any loops. for example, should result in True, because

Replace All Specific Characters in String using Python

I have a problem with a function I am trying to implement that needs to replace some letters (in a given string), for some other characters, defined on a dictionary. I have this dictionary: I want to pass a string that when a character matches any key from the dictionary (case insensitive match), it tries to save all the possible

Recursively searching for a string in a list of characters

I have a problem to solve which is to recursively search for a string in a list (length of string and list is atleast 2) and return it’s positions. for example: if we had ab with the list [‘a’,’b’,’c’], the function should return ‘(0,2)’, as ab starts at index 0 and ends at 1 (we add one more). if we

I want to extract all the values that a class object holds

I have an object Vm of Type <class ‘azure.mgmt.compute.v2019_07_01.models._models_py3.VirtualMachine’> I want to iterate over this object by a loop so that I don’t have to manually extract the values. Yes I’ve tried isinstance to check whether the value is of type <class ‘azure.mgmt.compute.v2019_07_01.models._models_py3.VirtualMachine’> and extract but in the next iteration it fails. For example let’s consider vm to be an

Python Return Command In Recursion Function

While learning Python and browsing the internet I stumble upon a piece of code in w3schools.com. I tried to run it using their built-in site Python IDLE and using my own Python 3.9.0 Shell. What I got is two different outputs. I want to know which output is the correct output and why is it providing two different outputs. The

Advertisement