data-structures Questions

6

Solved

if the input is an array, where null means no node. input: [1, 2, 3, null, 5, null, 7] Please assume that I have already checked the input. For each array[i], its parents array[i / 2] will not...
Benzoate asked 21/6, 2016 at 10:1

7

Solved

i have the following structure typedef struct { char data1[10]; char data2[10]; AnotherStruct stData; }MyData; for some reason the implementors choose not to make the stData as pointer, so i...
Lenten asked 18/9, 2014 at 5:44

4

Solved

I came across following problem: 'Find all the elements in an array which occur odd number of times'. My thoughts about this are: Use HashMap: Add values in the array as keys in the HashMap. Th...
Sock asked 5/11, 2013 at 17:26

11

Solved

I'm looking for a KDTree implementation in Java. I've done a google search and the results seem pretty haphazard. There are actually lots of results, but they're mostly just little one-off implemen...
Carcassonne asked 31/10, 2008 at 14:44

7

Solved

I know that we should rather be using dictionaries as opposed to hashtables. I cannot find a way to clone the dictionary though. Even if casting it to ICollection which I do to get the SyncRoot, wh...
Niche asked 17/2, 2010 at 9:50

4

Solved

I'm looking for a functional library with persistent data structures. I only need nested arrays and dictionaries. There are some functional javascript libraries, but they are not geared towar...

8

Solved

Today I was trying to push in java.util.Stack class and then use the Iterator to iterate (without using pop) through the items. I was expecting LIFO property but got surprised. Here is the code th...
Geodesy asked 7/6, 2013 at 20:52

5

Our database is designed based on EAV (Entity-Attribute-Value) model. Those who have worked with EAV models know all the crap that comes with for the purpose of flexibility. I asked my client abou...

3

Solved

I am currently working on adding type hints to a project and can't figure out how to get this right. I have a list of lists, with the nested list containing two elements of type int and float. The ...
Firebrat asked 11/5, 2022 at 10:21

5

Solved

A BST is generated (by successive insertion of nodes) from each permutation of keys from the set {1,2,3,4,5,6,7}. How many permutations determine trees of height two? I been stuck on this simple q...

20

Solved

Recently I have conversation with a colleague about what would be the optimal way to convert List to Map in Java and if there any specific benefits of doing so. I want to know optimal conversion ap...
Wordsmith asked 9/11, 2010 at 20:39

3

Solved

I am learning Scala and the book that I am using provides an exercise that asks me to define some functions on a tree structure. The tree is defined as: sealed trait Tree[+A] case class Leaf[A](...
Taoism asked 25/2, 2015 at 17:53

8

Solved

I need a data structure which works like the STL multiset but the TreeSet in Java doesn't allow duplicate elements. Is there any built-in data structure in Java which is equivalent to multiset?
Propagable asked 24/9, 2012 at 13:1

4

Solved

I need an Object Pool, and rather than implement it myself, I thought I would look around for a ready-made and tested Python library. What I found was plenty of other people looking, but not getti...
Mohammed asked 3/10, 2009 at 15:55

5

Solved

I have a list of objects and I need to find an object as quickly as possible (by it's name property). What data-structure should I use? I know I can use a Dictionary, but there wont ever be more th...
Indigenous asked 10/3, 2010 at 18:42

13

Solved

This is a simple question from algorithms theory. The difference between them is that in one case you count number of nodes and in other number of edges on the shortest path between root and concre...
Cispadane asked 8/4, 2010 at 21:47

9

I need a data structure that is a LinkedHashMap and is thread safe. How can I do that ?
Pheasant asked 8/9, 2009 at 4:7

10

Solved

Fibonacci numbers have become a popular introduction to recursion for Computer Science students and there's a strong argument that they persist within nature. For these reasons, many of us are fami...
Underbody asked 31/12, 2010 at 18:24

40

Solved

What's the simplest, library-free code for implementing array intersections in javascript? I want to write intersection([1,2,3], [2,3,4,5]) and get [2, 3]
Protector asked 11/12, 2009 at 3:4

7

Solved

I've been trying to solve this interview problem which asks to shuffle a string so that no two adjacent letters are identical For example, ABCC -> ACBC The approach I'm thinking of is to 1)...
Chose asked 26/8, 2016 at 17:34

2

Solved

What is the advantages of using Merkle trees over Hash lists? A hash list is a 2-level structure, Merkle tree is log n - level structure. Both can be used to verify if one of the nodes has changed....
Enslave asked 16/12, 2018 at 17:20

7

Solved

I am trying to learn analysis of algorithms and I am stuck with relation between asymptotic notation(big O...) and cases(best, worst and average). I learn that the Big O notation defines an upper ...

3

Solved

Is the computational complexity of TreeSet methods in Java, same as that of an AVLTree? Specifically, I want to know the computational complexity of the following methods: 1.add 2.remove 3.first ...
Midsection asked 17/1, 2013 at 12:49

4

I have the following list listaValores listaValores <- c() for(valores in 1:numRepeticion){ listaValores <- c(listaValores, readWorksheetFromFile(file = file.read, sheet = sheet.read, ...
Wesson asked 14/12, 2016 at 9:54

7

Solved

The link: http://www.geeksforgeeks.org/segment-tree-set-1-sum-of-given-range/. This is the quoted text: We start with a segment arr[0 . . . n-1]. And every time we divide the current segment int...
Bamford asked 12/2, 2015 at 6:21

© 2022 - 2024 — McMap. All rights reserved.