data-structures Questions

4

Solved

I often teach R to my peers and getting to explain the structure of nested data such as nested lists can be somewhat an arduous task and I find that creating a visual aid can go a long way. However...
Gibberish asked 18/7, 2020 at 16:25

3

Solved

I want to solve a leetcode question in Rust (Remove Nth Node From End of List). My solution uses two pointers to find the Node to remove: #[derive(PartialEq, Eq, Debug)] pub struct ListNode { pub...
Superjacent asked 17/1, 2019 at 14:3

11

Solved

In Python, which data structure is more efficient/speedy? Assuming that order is not important to me and I would be checking for duplicates anyway, is a Python set slower than a Python list?
Astto asked 14/5, 2010 at 0:55

12

Solved

I am using std::queue for implementing JobQueue class. ( Basically this class process each job in FIFO manner). In one scenario, I want to clear the queue in one shot( delete all jobs from the queu...
Nerland asked 2/4, 2009 at 10:16

9

Solved

I have a problem which requires a reversable 1:1 mapping of keys to values. That means sometimes I want to find the value given a key, but at other times I want to find the key given the value. B...
Brushwork asked 14/5, 2009 at 15:14

5

Solved

I have read that Trees are special cases of Graphs. Graphs can be directed or undirected. But if we consider tree as a data structure is it directed or undirected graph?
Contumacy asked 14/1, 2013 at 9:10

8

Solved

I want to compute an md5 hash not of a string, but of an entire data structure. I understand the mechanics of a way to do this (dispatch on the type of the value, canonicalize dictionary key order ...
Allanadale asked 24/3, 2011 at 10:46

13

Solved

I'd like to have a set of objects in Javascript. That is, a data structure that contains only unique objects. Normally using properties is recommended, e.g. myset["key"] = true. However, I need th...
Implausible asked 14/4, 2011 at 0:21

30

Solved

The following function is trying to find the nth to last element of a singly linked list. For example: If the elements are 8->10->5->7->2->1->5->4->10->10 then the res...
Krug asked 8/4, 2010 at 8:3

3

Solved

I've come across quite a bit of theory regarding Bloomier filters but have had no luck digging up an actual implementation of them (no luck at github, sourceforge, google, etc.). Does anyone know o...
Triggerfish asked 22/6, 2011 at 14:49

6

Solved

My question relates to this question asked earlier. In situations where I am using a queue for communication between producer and consumer threads would people generally recommend using LinkedBlock...

7

Solved

I want to create a python dictionary that returns me the key value for the keys are missing from the dictionary. Usage example: dic = smart_dict() dic['a'] = 'one a' print(dic['a']) # >>&gt...
Haunted asked 3/6, 2011 at 15:23

2

Once or twice a year, I run into the following issue: I have some type on which comparison operations might be expensive (e.g. the values are to big to keep in memory and need to be loaded form dis...
Clandestine asked 8/4, 2021 at 18:46

3

Solved

Reading Interactive Analysis of Web-Scale Datasets paper, I bumped into the concept of repetition and definition level. while I understand the need for these two, to be able to disambiguate occurr...
Metz asked 23/4, 2017 at 6:35

4

Solved

I am new to golang, and got stuck at this. I have an array of structure: Users []struct { UserName string Category string Age string } I want to retrieve all the UserName from this array of ...
Teaching asked 9/12, 2015 at 6:21

38

I would like to make anagram algorithm but This code doesn't work. Where is my fault ? For example des and sed is anagram but output is not anagram Meanwhile I have to use string method. not array...
Tyrothricin asked 3/12, 2012 at 21:40

3

An array is called palindromic if it remains the same after reversing the order of its elements. You have an array of strings arr. For each i, arr[i] consists of at least two characters. For each p...
Miasma asked 24/4, 2023 at 21:19

4

Solved

I'm studying data structures and linked lists, but I'm not getting the concept of how to make a copy of a linked list. Can someone explain this, possibly using pseudocode or C code?
Hierarchy asked 13/2, 2011 at 12:19

30

Naturally, for bool isprime(number) there would be a data structure I could query. I define the best algorithm, to be the algorithm that produces a data structure with lowest memory consumption for...
Humor asked 26/11, 2009 at 3:30

3

Solved

In the problem , I parse the input (integer) and simultaneously check if it exists in the data structure , if not then add it. Input is - 2 integers separated by space of size >=1 and <= 100000...
Slung asked 10/7, 2015 at 2:56

22

Solved

How do I sort a list of dictionaries by a specific key's value? Given: [{'name': 'Homer', 'age': 39}, {'name': 'Bart', 'age': 10}] When sorted by name, it should become: [{'name': 'Bart', 'age': 1...
Riba asked 16/9, 2008 at 14:27

15

Solved

Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with anoth...
Bother asked 27/6, 2015 at 7:52

5

Solved

It is my understanding that a data structure is essentially a blueprint which contains all the information necessary to create a final product according to its specification, and a data type is a p...
Electrothermics asked 1/7, 2014 at 16:48

5

Solved

In Haskell, I can define a binary tree as follows: data Bint a = Leaf a | Branch a (Bint a) (Bint a) then I can some operations on it as follows: height (Leaf a) = 1 height (Branch a l r) = 1 ...
Paver asked 3/9, 2013 at 8:24

4

Solved

where is the Fibonacci Heap in STL ? and if STL do not implement Fibonacci Heap what is the best practice to implement it using existing algorithms and containers in STL ?
Penalize asked 2/1, 2013 at 7:30

© 2022 - 2024 — McMap. All rights reserved.