How to solve a hard programming interview question
dailycodingproblem.com
How to solve a hard programming interview question
1–10 of 84 posts
Re: How to solve a hard programming interview question
#2Begin with a pointer at the start of each list, find the minimum of the elements being pointed at and increment that pointer, until all pointers are at the end of their respective lists. You could possibly even do it in place.
That was my first thought anyway.
Re: How to solve a hard programming interview question
#3Am I missing something, or couldn't you just merge the lists like you would in merge sort? Begin with a pointer at the start of each list, find the minimum of the elements being pointed at and increment that pointer, until all pointers are at the end of their respective lists. You could possibly even do it in place. That was my first thought anyway.
Can you describe how you would do this and talk about how it would impact the time complexity of the algorithm?
Re: How to solve a hard programming interview question
#4Am I missing something, or couldn't you just merge the lists like you would in merge sort? Begin with a pointer at the start of each list, find the minimum of the elements being pointed at and increment that pointer, until all pointers are at the end of their respective lists. You could possibly even do it in place. That was my first thought anyway.
Re: How to solve a hard programming interview question
#5Am I missing something, or couldn't you just merge the lists like you would in merge sort? Begin with a pointer at the start of each list, find the minimum of the elements being pointed at and increment that pointer, until all pointers are at the end of their respective lists. You could possibly even do it in place. That was my first thought anyway.
Re: How to solve a hard programming interview question
#6Re: How to solve a hard programming interview question
#7Re: How to solve a hard programming interview question
#8Re: How to solve a hard programming interview question
#9Am I missing something, or couldn't you just merge the lists like you would in merge sort? Begin with a pointer at the start of each list, find the minimum of the elements being pointed at and increment that pointer, until all pointers are at the end of their respective lists. You could possibly even do it in place. That was my first thought anyway.
> find the minimum of the elements being pointed at Can you describe how you would do this and talk about how it would impact the time complexity of the algorithm?
Re: How to solve a hard programming interview question
#10If the lists are on other nodes, like in a petabyte sort, that’s where it gets complicated because you need to recover from node failures during the sort.