Answer 2
What is the computational complexity of your answer in Question 1? Can you explain why?
The computational complexity of Question 1 is O(n2).
Explanation:
for i in range(len(arr2)):
curl -H 'Content-Type: application/json' -X POST http://localhost:5984/_replicate -d ' {"source": "http://localhost:5984/bec-ember-three/", "target": "http://128.199.160.40:5984/bec-ember-recover"}' | |
curl -X POST http://128.199.160.40:5984/_replicate -H "Content-Type: application/json" -d '{"source": "test_database", "target":"bec-practice", "doc_ids": ["practices"]}' |
def isSubset(arr1, arr2): | |
count = 0 | |
flagSubset = False | |
for i in range(len(arr2)): | |
for j in range(len(arr1)): | |
if(arr2[i].strip().upper() == arr1[j].strip().upper()): | |
count+=1 | |
break | |
Answer 2
What is the computational complexity of your answer in Question 1? Can you explain why?
The computational complexity of Question 1 is O(n2).
Explanation:
for i in range(len(arr2)):
import time | |
def recursiveFibonacci(number, fn1, fn2): | |
fnNext = fn1 + fn2 | |
fn1 = fn2 | |
if number < fnNext: | |
print(fnNext) | |
else: | |
recursiveFibonacci(number, fn1,fnNext) |
function createArrayOfFunctions(y){ | |
var arr = []; | |
x = 1 | |
for (let i = 0; i < y ; i++){ | |
arr[i] = function(x){ | |
return x + i; | |
} | |
} | |
return arr; |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | |
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>ATE-Dashboard</title> |
{% for key, value in test_codes_dict.items %} | |
<option value="{{ key }}">{{ value }}</option> | |
{% endfor %} |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just
from django.db.models.signals import post_delete, pre_save | |
from django.dispatch import receiver | |
from django.db import models | |
""" Whenever ANY model is deleted, if it has a file field on it, delete the associated file too""" | |
@receiver(post_delete) | |
def delete_files_when_row_deleted_from_db(sender, instance, **kwargs): | |
for field in sender._meta.concrete_fields: | |
if isinstance(field,models.FileField): | |
instance_file_field = getattr(instance,field.name) |