data-structures Questions

16

Solved

When is it better to use a List vs a LinkedList?
Transonic asked 4/10, 2008 at 8:23

16

Solved

When is it better to use a List vs a LinkedList?
Drank asked 4/10, 2008 at 8:23

16

Solved

When is it better to use a List vs a LinkedList?
Fluorite asked 4/10, 2008 at 8:23

11

Solved

Given a stack S, need to sort the stack using only Push, Pop, Top, IsEmpty, IsFull. Looking for most simple solution. Edited: Removed in place condition. Can't use another stack or queue.
Samson asked 30/1, 2010 at 17:52

5

I am new to hadoop and trying to process wikipedia dump. It's a 6.7 GB gzip compressed xml file. I read that hadoop supports gzip compressed files but can only be processed by mapper on a single jo...
Gretagretal asked 12/4, 2011 at 4:0

4

I'm trying to figure out which structure would be better for doing several radius search of points, a kd-tree or an octree? It was already mentioned in this question but there was no answer. It see...
Lushy asked 1/8, 2013 at 15:20

5

Solved

I wrote a Stack and Queue implementation (Linked List based). There is one stack (bigStack). For example, I separate bigStack (example: stackA and stackB). I pop() a node from bigStack, I push() in...
Leptosome asked 15/10, 2012 at 19:36

35

Solved

I need to find the kth smallest element in the binary search tree without using any static/global variable. How to achieve it efficiently? The solution that I have in my mind is doing the operation...
Treasonable asked 24/2, 2010 at 20:18

7

Solved

This is my first course in data structures and every lecture / TA lecture , we talk about O(log(n)) . This is probably a dumb question but I'd appreciate if someone can explain to me exactly what d...
Dispirited asked 29/4, 2012 at 3:57

3

Solved

I want to remove the last object from an ArrayList quickly. I know that remove(Object O) takes O(n) in an ArrayList, but I wonder if it is possible to do this in constant time since I just want to...
Gavette asked 7/6, 2013 at 15:27

5

Solved

So I've looked around the web and a couple of questions here in stackoverflow here are the definition: Generally, an internal node is any node that is not a leaf (a node with no children) Non-lea...
Geosynclinal asked 18/1, 2013 at 4:58

7

Solved

I have a streaming input which has repeated values. I can use any data structure but I have to count the number of occurence of each element. Suppose I have a list of mobile phone suppliers like th...
Cherenkov asked 29/6, 2009 at 16:3

3

Solved

For those who know Python, the best way to explain what I want is by analogy: [1, [2, 3], 4, [5, [6]], 7] Obviously, I can implement my own class (template) to do this, but if the standard library...
Peta asked 21/7, 2021 at 5:3

21

Which is the best data structure that can be used to implement a binary tree in Python?
Steinway asked 8/4, 2010 at 8:23

4

Does anyone know how the built in dictionary type for python is implemented? My understanding is that it is some sort of hash table, but I haven't been able to find any sort of definitive answer.
Pase asked 29/11, 2008 at 7:35

16

Solved

I was given this problem in an interview. How would you have answered? Design a data structure that offers the following operations in O(1) time: insert remove contains get random element
Suzannsuzanna asked 15/4, 2011 at 20:48

23

Solved

How can I print a binary tree in Java so that the output is like: 4 / \ 2 5 My node: public class Node<A extends Comparable> { Node<A> left, right; A data; public Node(A d...
Goncourt asked 11/2, 2011 at 3:28

7

Let us assume that we have a tree consisting on N nodes. The task is to find all longest unique paths in the tree. For example, if the tree looks like following: Then there are three longest uni...
Chomp asked 19/8, 2015 at 8:49

14

Solved

I have two generic Dictionaries. Both have the same keys, but their values can be different. I want to compare the 2nd dictionary with the 1st dictionary. If there are differences between their val...
Moonshine asked 3/3, 2012 at 15:41

9

What is the difference between backtracking and recursion? How is this program working? void generate_all(int n) { if(n<1) printf("%s\n", ar); else{ ar[n-1]='0'; //fix (n)th bit as ...
Chantay asked 31/10, 2014 at 8:58

9

Solved

So I've been poking around with C# a bit lately, and all the Generic Collections have me a little confused. Say I wanted to represent a data structure where the head of a tree was a key value pair,...
Hydromedusa asked 12/8, 2008 at 13:12

9

Solved

I've spent a few minutes manually re-ordering fields in a struct in order to reduce padding effects[1], which feels like a few minutes too much. My gut feeling says that my time could probably be b...
Tartuffe asked 15/5, 2009 at 7:57

3

Solved

What is the difference between primary and secondary clustering in hash collision management?

2

Solved

I'm not too well-versed about the actual algorithms used in string matching with tries. I'm wondering why there seems to be more focus on suffix tries for string matching rather than prefix tries....
Wandie asked 14/7, 2011 at 11:28

13

Solved

Does Java have an analog of a C++ struct: struct Member { string FirstName; string LastName; int BirthYear; }; I need to use my own data type.
Prophetic asked 2/3, 2011 at 13:32

© 2022 - 2024 — McMap. All rights reserved.