Answers for "treemap c++"

0

treemap

>>> def treemap(lst):
...     for i in range(len(lst)):
...         if type(lst[i])==int:
...             lst[i]=lst[i]**2
...         elif type(lst[i])==list:
...             treemap(lst[i])
...     return lst
>>> lst = [1, 2, 3, [4, [5, 6], 7]]
>>> print(treemap(lst))
[1, 4, 9, [16, [25, 36], 49]]
Posted by: Guest on October-30-2021
1

treemap

- TreeMap doesn't have null key and keys are sorted
 Can contain only unique keys and keys are sorted in ascending order.
Posted by: Guest on December-05-2020
0

treemap

def treemap(lst):
    cp = list()
    for element in lst:
        if isinstance(element, list):
            cp.append(treemap(element))
        else:
            cp.append(element**2)
    return cp
Posted by: Guest on October-30-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language