recursion Questions

2

Solved

What is the difference between divide and conquer, and branch and reduce. From Exact Exponential Algorithms by Fomin and Kratsch, branch and reduce algorithms uses two types of rules: A reduc...
Cribbs asked 14/12, 2016 at 10:44

1

Solved

Since version 4.4.0, R supports tail recursion through the Tailcall function. I automatically assumed that it means an improvement for codes that use tail recursion. However, consider the following...
Forenamed asked 12/9 at 18:17

7

Solved

Consider the following simple DAG: 1->2->3->4 And a table, #bar, describing this (I'm using SQL Server 2005): parent_id child_id 1 2 2 3 3 4 //... other edges, not connected to the su...

13

Solved

I would like to know how else I can optimize bubble sort so that it overlooks elements that have already been sorted, even after the first pass. Eg. [4, 2, 3, 1, 5, 6] --> [2, 3, 1, **4, 5, 6**]...
Sabadell asked 24/4, 2013 at 14:48

7

Solved

Good afternoon. I'm sorry if my question may seem dumb or if it has already been posted (I looked for it but didn't seem to find anything. If I'm wrong, please let me know: I'm new here and I may n...
Sacred asked 20/7, 2020 at 14:12

4

Solved

I have the following JavaScript object structure: var options = { optionOne: [true, false], optionTwo: [true, false], optionThree: [ null, {property1: 9, property2: 7}, {property1: 4, proper...
Hispania asked 29/9, 2015 at 7:41

9

Solved

I need to find the fastest way to remove all $meta properties and their values from an object, for example: { "part_one": { "name": "My Name", "something"...
Confessional asked 30/7, 2015 at 16:14

7

I have a tree structure in the DB with TreeNodes table. the table has nodeId, parentId and parameterId. in the EF, The structure is like TreeNode.Children where each child is a TreeNode... I also h...
Reorder asked 15/2, 2010 at 14:17

5

I was asked to calculate the following nested root expression using recursion only. I wrote the code below that works, but they allowed us to use only one function and 1 input n for the purpose ...
Hormone asked 4/4, 2020 at 16:58

9

Trying to create a function that returns the # of files found a directory and its subdirectories. Just need help getting started
Bashkir asked 4/6, 2013 at 5:22

28

I'm exercising and trying to write a recursive array flattening function. The code goes here: function flatten() { var flat = []; for (var i = 0; i < arguments.length; i++) { if (arguments[i...
Jhansi asked 5/5, 2015 at 8:56

8

Solved

I am currently using Renci SSH.NET to upload files and folders to a Unix Server using SFTP, and creating directories using sftp.CreateDirectory("//server/test/test2"); works perfectly, a...
Graffito asked 12/4, 2016 at 6:15

3

Solved

Infinite loops without side effect are undefined behaviour. See here for the example from cppreference. Much simpler example: int foo() { while(true) {} return 42; } Now consider the almost eq...
Judie asked 17/4, 2019 at 19:23

6

Solved

I want to get a list of all sub-directories within a directory. If that works I want to expand it to a recursive function. However my initial approach to get the subdirs fails. It simply shows ...
Aprilaprile asked 22/3, 2012 at 17:46

2

I have a nested array tree, generated from a flat array with the following function: function convertToTree( array $flat, $idField = 'id', $parentIdField = 'parentId', $childNodesField = 'child...
Cristionna asked 25/6, 2013 at 9:11

6

Solved

SQL is obviously not meant for this but I'm wondering if it's possible to do this with SQL as a sort of challenge. Given an arithmetic parse tree such as: 7-2*3 Which could be represented as: - ...
Schrecklichkeit asked 21/3 at 20:48

17

Solved

I'm a pretty experienced frontend engineer with a weak CS background. I'm trying to get my head around the concept of recursion. Most of the examples and purported explanations I can find just aren...
Motivate asked 1/2, 2011 at 5:21

8

Solved

I want to unflatten an object like this... var obj2 = { "firstName": "John", "lastName": "Green", "car.make": "Honda", "car.model": "Civic", "car.revisions.0.miles": 10150, "car.revisions.0....
Certie asked 9/3, 2017 at 12:6

7

I have an object graph sprinkled with DataAnnotation attributes, where some properties of objects are classes which themselves have validation attributes, and so on. In the following scenario: pu...
Violaceous asked 5/10, 2011 at 15:7

2

Solved

I'm building a recursive function that does a match on a list l. In the cons branch I need to use the information that l = cons a l' in order to prove that the recursive function terminates. Howeve...
Seifert asked 5/12, 2014 at 12:48

12

Solved

The unzip command doesn't have an option for recursively unzipping archives. If I have the following directory structure and archives: /Mother/Loving.zip /Scurvy/Sea Dogs.zip /Scurvy/Cures/Limes...
Elysha asked 20/9, 2008 at 12:6

4

Solved

I used the following command: aws s3 ls s3://mybucket/mydir --recursive > bigfile The resulting file was too huge (9.5MB) to conveniently work with, since I need to eyeball the info I'm look...
Edgy asked 24/1, 2019 at 21:17

5

Solved

Haskell has a takeWhile function: Prelude> takeWhile odd [1,3,5,7,8,9] [1,3,5,7] It “takes” elements from a list as long as applying the predicate function results in True. At the point it be...
Endostosis asked 23/3, 2018 at 13:40

14

This is my District Controller, when I try to fetch data after saving I get the error, even when I try get object form getDistrict(Long id) the same strikes please suggest some way, am very new at ...
Incommutable asked 7/12, 2017 at 10:37

12

Solved

if my structure is { :a :A :b :B :c { :d :D } :e { :f { :g :G :h :H } } } I would like to get a function called keys-in that returns something like: [[:a] [:b] [:c :d] [:e :f :g] [:e ...
Kieserite asked 14/2, 2014 at 0:51

© 2022 - 2024 — McMap. All rights reserved.