Category : algorithm

I have to create a binary like data structure like below:- Tree Where each node represents a user profile. When a user will create a profile, they would enter their parent’s user ID(for example A01) and choose their orientation(left/right), For example, the new user while creating their account puts in A01 as their parent and ..

Read more

The question is based on 0/1 knapsack problem. This is brief intro about 0/1 knapsack=> Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack.(To know about knapsack in more detail , refer to this article> https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/) My question: We ..

Read more

An intranet has n computers numbered 1 through n and m one-way communication links between several servers. A path of the form u, v, t represents the time it takes to transfer a file from server u to server v as t. When a computer receives a file from a given computer, it transfers that ..

Read more

I have a design dilemma when doing a vector class from a book example and started wondering, what is the rule of thumb or closest to rationalize when an algorithm or function should be a member function or not? For example, given the class: struct vector2d { float x, y; vector2d() = default; vector2d(float x, ..

Read more