Are all queues, priority queues? If not, what is the difference?

Just beginning my journey of learning data structures and algorithms, and I’m getting hung up on the fact that there is information everywhere about this kind of stuff with different nicknames for each data structure. But in layman’s terms are all queues in fact priority queues, the priority bit being exactly what makes them so… Read More Are all queues, priority queues? If not, what is the difference?

What is the Big o notation of the longest consecutive sequence algorithm below

I google the solution for the longest consecutive sequence algorithm here is the link to the question in leetcode leetcodeQuestion and below is the algorithm solution. I was confused by some of the comments on the website where i got the solution some where saying that the solution is not O(n) time complexity since there… Read More What is the Big o notation of the longest consecutive sequence algorithm below

Can you tell me what is the runtime complexity of this algo?

This function simply takes multidimensional array and makes it flat for example flatArray([1,[1,2,4,[2,3]],1]) -> [1,1,2,4,2,3,1] I would like to know what time complexity this algorithm has. let flatArray = function(numsArr){ let container = []; for(let i = 0;i<numsArr.length;i++){ if(Array.isArray(numsArr[i])){ container = […container,…flatArray(numsArr[i])] }else{ container.push(numsArr[i]) } counter ++ } return container; }; >Solution : Your function… Read More Can you tell me what is the runtime complexity of this algo?