data-structures Questions
2
Solved
I've taken a look at this questions , but I still don't see the difference between a Suffix tree and a Trie .
Both have all the substrings of a given string , so where do they differ from one ano...
Soda asked 1/8, 2013 at 6:48
9
Solved
Among n persons,a "celebrity" is defined as someone
who is known by everyone but does not know anyone. The
problem is to identify the celebrity, if one exists, by asking the
question only of the fo...
Cimon asked 23/4, 2015 at 5:27
4
Is it possible to implement a concurrent hash map purely in Kotlin (without Java dependency)? I am new to Kotlin and it looks like there is no obvious API available in kotlin.collections.
Pydna asked 2/11, 2020 at 21:49
3
Solved
I have implemented the design a LRU Cache Problem on LeetCode using the conventional method (Doubly Linked List+Hash Map). For those unfamiliar with the problem, this implementation looks something...
Bilander asked 17/2, 2019 at 6:21
6
Solved
I want to use a circular list.
Short of implementing my own (like this person did) what are my options?
Specifically what I want to do is iterate over a list of objects. When my iterator reaches...
Fichtean asked 3/6, 2009 at 21:57
4
Solved
I need to build a data-structure like this:
map[string]SomeType
But it must store values for about 10 minutes and then clear it from memory.
Second condition is records amount - it must be huge...
Conative asked 25/8, 2014 at 10:43
2
Basic Facts
Lists are mutable (supporting inserts, appending etc.), Tuples are not
Tuples are more memory efficient, and faster to iterate over
So it would seem their use-cases are clear. F...
Tana asked 8/7 at 2:16
5
Solved
I study data structures and I want to ask what are the equivalents of STL containers.
for example
vector = dynamic array
queue = queue
stack = stack
priority_queue = heap
list = linked list
set ...
Unclasp asked 16/6, 2012 at 15:14
19
Solved
This is one of the programming questions asked during written test from Microsoft. I am giving the question and the answer that I came up with. Thing is my answer although looks comprehensive (at l...
Travers asked 27/2, 2010 at 18:0
17
I have a question where I need to rotate an array left k times.
i.e. if k = 2, [1, 2, 3, 4, 5] . -> [3, 4, 5, 1, 2]
So, my code is:
def array_left_rotation(a, n, k):
for i in range(n):
t = a[i...
Sisyphus asked 24/3, 2018 at 7:8
4
Solved
I am using two arrays to accomplish a task of checking if values in array1 exist in array2. If so remove the content in array1 and keep checking till array1 is empty. If they dont exist just return...
Polyadelphous asked 3/4, 2014 at 21:29
8
Solved
In C#, an anonymous type can be as follows:
method doStuff(){
var myVar = new {
a = false,
b = true
}
if (myVar.a)
{
// Do stuff
}
}
However, the following will not compile:
method ...
Tremor asked 28/1, 2012 at 8:7
7
Solved
I'm working on a HackerRank problem that's finding the largest sum of the elements in upper-left quadrant of a 2N x 2N matrix after reversing rows and columns. For example, if the matrix is
M = [
...
Microclimate asked 23/10, 2016 at 17:7
5
Solved
Here is my understanding of linear probing.
For insertion:
- We hash to a certain position. If that position already has a value, we linearly increment to the next position, until we encounter an ...
Pinchbeck asked 11/3, 2020 at 16:58
7
What are the practical scenario for choosing among the linkedhashmap and hashmap? I have gone through working of each and come to the conclusion that linkedhashmap maintains the order of insertion ...
Greenlaw asked 29/10, 2014 at 5:7
10
I'm trying to solve this problem of Union-Find which goes like
Successor with delete. Given a set of N integers S={0,1,…,N−1} and a
sequence of requests of the following form:
Remove x from ...
Inviolable asked 17/3, 2017 at 15:7
8
I have an array of objects with property date.
What I want is to create array of arrays where each array will contain objects with the same date.
I understand, that I need something like .filter ...
Defilade asked 10/1, 2017 at 8:43
3
Solved
I'm working on implementing various subdivision algorithms (such as catmull-clark); to do this efficiently requires a good way to store information about a grid of tesselated polygons. I implemente...
Bilbe asked 12/3, 2013 at 15:35
6
Solved
What exactly is the top view of a binary tree?
I find great ambiguity and lack of clarity from the articles I find.
For example, this is what is used to demonstrate the top view on geeksforgeeks:...
Histology asked 22/4, 2020 at 18:4
9
Solved
I have this code below where I am inserting a new integer into a sorted LinkedList of ints but I do not think it is the "correct" way of doing things as I know there are singly linkedlist with poin...
Peraea asked 9/8, 2013 at 10:37
3
Solved
Language: C++
One thing I can do is allocate a vector of size n and store all data
and then sort it using sort(begin(),end()). Else, I can keep putting
the data in a map or set which are ordered i...
Revitalize asked 6/5, 2018 at 10:49
11
Solved
I currently have a need to temporarily swap out values in a JavaScript string, and therefore I will need to have a two-way map/hash thing.
For example, let's say I want to change \* to __asterisk_...
Englishman asked 12/1, 2014 at 3:7
4
Solved
I've been spending a lot of time reading online presentations and textbooks about the cut property of a minimum spanning tree. I don't really get what it's suppose to illustrate or even why it's pr...
Mudguard asked 25/7, 2010 at 2:1
2
Set has contains function which returns true if member exists in the set; otherwise, false.
and its complexity is O(1).
I want to know how its complexity is constant O(1) i.e. it does not depends...
Leong asked 8/5, 2018 at 18:56
16
Solved
Why does the C++ STL not provide any "tree" containers, and what's the best thing to use instead?
I want to store a hierarchy of objects as a tree, rather than use a tree as a performance enhancem...
Tweedsmuir asked 15/10, 2008 at 18:52
1 Next >
© 2022 - 2024 — McMap. All rights reserved.