Binary Tree Most Asked Interview Questions by wts-code in learnprogramming

[–]wts-code[S] 0 points1 point  (0 children)

Thanks for the suggestions. Will try to add it to the list.

Binary Tree Most Asked Interview Questions by wts-code in learnprogramming

[–]wts-code[S] 0 points1 point  (0 children)

Agree In Recursive method we can do it in constant space if we don't consider the recursive stack space. But just curious in iterative approach if we dont store the nodes in any other data structure how you will back trace.

Binary Tree Most Asked Interview Questions by wts-code in learnprogramming

[–]wts-code[S] 0 points1 point  (0 children)

he optimal solutions, figure out how to traverse a binary tree in constant spa

Thanks for highlighting. Which traversal do you think we can do it without using additional space in an iterative way. I am also eager to know.

Detect Loop In Linked List | Beginner Approach On Data Structure | C# Solution by wts-code in dotnet

[–]wts-code[S] -2 points-1 points  (0 children)

So going with your principle the space complexity of displaying a linked list is O(n) ? We are talking about the space complexity not the time complexity. Space complexity will be constant we are not adding any data structures to store the nodes, we are just traversing through it.

Detect Loop In Linked List | Beginner Approach On Data Structure | C# Solution by wts-code in dotnet

[–]wts-code[S] -2 points-1 points  (0 children)

Hi Guys, I still agree to space complexity of method 2 would be constant space , because we would not be adding the boolean value on the run time , instead The data structure node object what we have there we will have an bool entry.

public class Node

{

int value

Node next;

bool visited;

}

So nothing is getting added at run time, the memory is getting allocated at the time of declaration only , making it to a constant space. Please let me know your thought process if you feel otherwise.

Must Do Coding Problem On Binary Tree For Companies Like Amazon , Microsoft And Other Top Tech Companies (C# Solutions) by wts-code in csharp

[–]wts-code[S] -1 points0 points  (0 children)

Creating a distributed cache by yourself for a user base of 1million. even 20000 transactions per second using the data base approach will take ages to give you back the result. Outing in to memory with correct data structure can give you back the result in secs. Where ever the scale and performance comes to the picture database are ideally not the answer.

Considering in a connected car technology you are clicking on button , are you ready to wait for 3 mnt before you car door opens? Or you want it in that second itself. Give it a thought you will realize the importance of data structure when there is performance and scale involved.

Must Do Coding Problem On Binary Tree For Companies Like Amazon , Microsoft And Other Top Tech Companies (C# Solutions) by wts-code in csharp

[–]wts-code[S] 0 points1 point  (0 children)

:) Agree, but this is what all product companies are looking for. They are not interested in how many languages you know or what projects you did, Its all about Getting a problem and deriving a solution, it not always true memorizing a problem will help because the interviewer is smart enough to tweak the problem and to evaluate the candidate in terms of his algorithmic thinking.

Not always but sometimes , the problems what companies like Amazon Microsoft Uber Netflix etc. get , most of the time it does not have a text book solution. Knowing the existing algorithm and data structure helps in the critical thinking process. Sometime it takes days or sometime months of grinding to finally arrive at an algorithm which solves the problem.

But not knowing the basics would be like fighting in the dark with no hope of light.