Questions tagged [recursion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
595 views

Slice a list for recursive function in pset3 search

I'm using a recursive function for pset3's binary search. How do you call the same function again giving half the list as an argument?
0
votes
1answer
257 views

result of search function ignored by find.c

for negative results ,its O.K. 0 , 1 , 2 , 3 , 4 , 4 , 5 , 6 , 7 , 7 , 8 , 9 , 11 , 22 , 33 , 66 , 78 , 88 , 455 , 999 , lower =0 ,upper = 19 ,mid = 9 ,values[mid] = 7 lower =10 ,upper = 19 ,mid = ...
1
vote
0answers
2k views

Valgrind says “Invalid read of size 4” while freeing memory recursively in a trie

My PSET "mispelling" works fine and contains no memory leak but when I run the program with Valgrind it says Invalid read of size 4. My unload function calls a deleteTrie function which looks like ...
0
votes
1answer
3k views

Speller Unload Trie with Recursion

node* root; bool unload(void) { freenodes(root); return true; } freenodes function(node* path) { loop over all nodes { if node is not null (path -> children[i]) ...

1
2