15,904,652 members
Home / Discussions / Algorithms

# Algorithms

 Re: Vehicle routing problem for large graph harold aptroot7-Mar-20 13:35 harold aptroot 7-Mar-20 13:35
 Re: Vehicle routing problem for large graph Member 147325528-Mar-20 0:51 Member 14732552 8-Mar-20 0:51
 Re: Vehicle routing problem for large graph harold aptroot8-Mar-20 4:28 harold aptroot 8-Mar-20 4:28
 Re: Vehicle routing problem for large graph Member 147325528-Mar-20 6:41 Member 14732552 8-Mar-20 6:41
 Re: Vehicle routing problem for large graph harold aptroot8-Mar-20 7:48 harold aptroot 8-Mar-20 7:48
 Re: Vehicle routing problem for large graph Member 147325528-Mar-20 8:07 Member 14732552 8-Mar-20 8:07
 Re: Vehicle routing problem for large graph Hailu Worku Obsse17-Mar-20 20:15 Hailu Worku Obsse 17-Mar-20 20:15
 Recursion Member 1475643326-Feb-20 10:10 Member 14756433 26-Feb-20 10:10
 I'm confused about recursion in mergesort. I've tried putting comments in the code that track the variables so its easier to understand what's going on, but I'm still struggling. For an array of size 4, I understand the initial process - mergesort(o,3). 0 is less than 3, so we find the middle value = 1. Low = 0, Middle,1 and High = 3 mergesort(0,1) 0 is less than 1, so we find the middle value = 0. Low = 0, Middle = 0, High 1 0 is not < 0, so the function is called again but with (middle +1 and high) as its parameters. 1 is not < 1, so the function merge is called with the parameters (0,0,1). So far so good ! But when the recursive function kicks in again, this time it has the values (0,2,3) which has been passed to the second recursive function (middle +1, high) How did this happen ?? Is it because the second recursive function is using the same parameters as the first function on its second iteration? (0,1,3). I've been looking all over for this, and lots of people just seem to skim over this step. I'm new, so would really appreciate any advice anyone has to give. I've tried experimenting with recursive functions, like finding the nth term in fib series, and sum of triangular numbers, which I can do now, but it doesnt seem to be helping in solving this problem. Big thanks ``` public void mergesort (int low, int high) { sum ++; System.out.println("Round " + sum + ". Parameters being passed in = " + low + " " + middle + " " +high); if (low
 Re: Recursion Daniel Pfeffer26-Feb-20 21:22 Daniel Pfeffer 26-Feb-20 21:22
 Re: Recursion Member 1475643326-Feb-20 22:39 Member 14756433 26-Feb-20 22:39
 Re: Recursion Daniel Pfeffer26-Feb-20 23:25 Daniel Pfeffer 26-Feb-20 23:25
 Re: Recursion Member 1475643326-Feb-20 23:33 Member 14756433 26-Feb-20 23:33
 Negating a number Nand3219-Feb-20 2:53 Nand32 19-Feb-20 2:53
 Re: Negating a number Richard MacCutchan19-Feb-20 3:04 Richard MacCutchan 19-Feb-20 3:04
 Re: Negating a number Nand3219-Feb-20 3:08 Nand32 19-Feb-20 3:08
 Re: Negating a number Richard MacCutchan19-Feb-20 3:47 Richard MacCutchan 19-Feb-20 3:47
 Re: Negating a number Richard Deeming19-Feb-20 3:23 Richard Deeming 19-Feb-20 3:23
 Re: Negating a number Nand3219-Feb-20 3:32 Nand32 19-Feb-20 3:32
 LALR vs LR parsing honey the codewitch13-Feb-20 3:53 honey the codewitch 13-Feb-20 3:53
 Re: LALR vs LR parsing Member 1298255823-Feb-20 6:45 Member 12982558 23-Feb-20 6:45
 Re: LALR vs LR parsing honey the codewitch23-Feb-20 7:29 honey the codewitch 23-Feb-20 7:29
 Routing algorithm Rocks10028-Jan-20 8:23 Rocks100 28-Jan-20 8:23
 Re: Routing algorithm Richard Deeming28-Jan-20 9:43 Richard Deeming 28-Jan-20 9:43
 Re: Routing algorithm Rocks10028-Jan-20 10:11 Rocks100 28-Jan-20 10:11
 Re: Routing algorithm Rocks10028-Jan-20 11:36 Rocks100 28-Jan-20 11:36
 Last Visit: 31-Dec-99 18:00     Last Update: 24-May-24 2:58 Refresh ᐊ Prev1...14151617181920212223 Next ᐅ