A data structure is a way of organizing data in a fashion that allows particular properties of that data to be queried and/or updated efficiently.
0
votes
0answers
5 views
Normalized Database Diagram [migrated]
So I am working on my DB design skills, and have tried to create a normalized MySQL database. Here is the diagram:
The reason I added the Address table is to break the address fields into separate ...
0
votes
0answers
19 views
repeating problem with Simon says game? [on hold]
overview of the assignment: Simon says game of 4 level, random number 1-4 only;start with one digit then keep adding until hit the user input level. i have few problems, and i cant seem to find them. ...
-1
votes
0answers
17 views
Array implementation of Stack in C [on hold]
The code is
http://ideone.com/Ha70ph
I've tried to create an implementation of Stack using arrays. I am having some problem in the loop. The program runs, it asks for the choice and from switch case ...
0
votes
2answers
53 views
Populate inorder successor for all nodes
Given a binary tree where each node has following structure, write a
function to populate next pointer for all nodes. The next pointer for
every node should be set to point to inorder ...
0
votes
1answer
24 views
1
vote
1answer
55 views
Create a complete binary tree
Write a program to create a complete binary tree, which includes an addItem method such that an individual element can be inserted into the tree to maintain the ...
3
votes
3answers
117 views
3
votes
3answers
98 views
Speeding up storage of about 220000 values in Core Data
I use this code on the app's first run to save about 220000 values into core data. The file Navaids.txt has about 200000 and Waypoints.txt has about 20000 lines, where I get data from each line and ...
-1
votes
1answer
44 views
ArrayList implementation in C [closed]
Although I know I can use calloc then realloc to make a dynamic array in C, and that I also need a variable to keep track of the ...
2
votes
2answers
24 views
Enforcing Type with Boiler Plates
This is an implementation of Mat's List using by Pseudo-inheriting my Pythonic-List. Inheritance is not built into VBA, but it can be simulated by composing the inherited class and mimicking all it's ...
1
vote
1answer
59 views
Creating a Custom Set Data Structure in Ruby
I wrote a set DS with some useful functions. Not sure if it is a good implementation and if there are other essential functions that a set should support.
...
8
votes
2answers
244 views
Simple key-value store in C, take 2
Followup to Simple key-value store in C.
Response to previous reviews
You may want to hide the KVSstore structure
Done.
Add a comparison function pointer to KVSstore. If this pointer is ...
4
votes
2answers
73 views
Simple key-value store in C
I needed a simple key-value store. Here's what I came up with.
Usage
Use kvs_create and kvs_destroy to create stores and clean ...
4
votes
2answers
75 views
Traversing and printing complex Dictionary types (Scripting.Dictionary) - Dictionary inside of a Dictionary
Based on this SO post - also reposted on vba4all.com with a few more details and explanations.
Please notice there currently is no error handling whatsoever as I didn't analyse and consider any traps ...
2
votes
1answer
72 views
Autocomplete Trie Optimization
I'm currently playing with the Typeahead problem on Talentbuddy. There are already 2 questions on this subject (Typeahead Talent Buddy and Typeahead autocomplete functionality challenge), but none of ...
10
votes
3answers
106 views
VBA Python-like List Class
VBA's Collection class is lacking so I created a basic List class using Python's as a template. This could make future derived ...
5
votes
4answers
107 views
Dynamically-sized stack - follow-up 3
Follow up of - Dynamically-sized stack - follow-up 2
I've took the tips given to me, and what I did now is:
Use same case type for type stack and it's functions
Returning 1 if push failed due to an ...
4
votes
1answer
292 views
Queue Implementation using a Linked List
For understanding the concepts, I've implemented the Queue data structures using a linked list. Is there anything to improve?
LinkList.java
...
9
votes
1answer
63 views
Yet Another Fraction
A recent question inspired me to implement a Fraction class. I decided to write this one in vba, because I like writing tools for the poor souls that still have to ...
6
votes
1answer
59 views
Dynamically-sized stack - follow-up 2
Follow up of - Dynamically-sized stack - follow up
I've took the tips given to me, and what I did now is:
changing the function names to have a prefix
making the ...
4
votes
2answers
124 views
Dynamically-sized stack - follow up
Follow up of - Which is a better implementation of a stack data structure (based on an array)?
Please review my stack implementation from before. I've made it dynamically sized if needed and made a ...
1
vote
3answers
224 views
Find the Max Width Of Tree
1
/ \
2 3
/ \ \
4 5 8
/ \
6 7
Width of a tree is maximum of widths of all levels.
For the above tree,
width ...
2
votes
1answer
59 views
Which is a better implementation of a stack data structure (based on an array)?
This is a version I made:
...
1
vote
2answers
42 views
Number of maximal PAIRS-values
I had an interview question like this:
In a company there are different people. One can measure how well they
suits for pair coding as follows:
First, let us compute the PAIRS-value which ...
2
votes
2answers
64 views
1
vote
0answers
39 views
Lightweight tabulation written in Python
I wrote this module in python for some minor tabulation needs in my science projects. This was very helpful for testing, debugging and plotting various data. I often use dictionaries for storing such ...
5
votes
3answers
182 views
Bubble sorting in C
I've been into algorithms lately, so I wanted to apply a simple algorithm using a language of my choice, which was C in this case.
I've implemented the bubblesort algorithm (for strings) in a simple ...
7
votes
3answers
654 views
Managing student budgets
I have just started to play around with C++ and I want to make my code efficient and clutter free. Please critique this code constructively and give feedback that will help me in my programming ...
0
votes
1answer
34 views
Find swapped nodes in BST
A BST has two nodes swapped. Figure out which two nodes.
Looking for code-review, optimizations and best practices.
...
0
votes
2answers
235 views
Josephus Problem in Java
Problem
The Josephus Problem is a famous mathematical puzzle that goes back to
ancient times. There are many stories to go with the puzzle. One is
that Josephus was one of a group of Jews who ...
10
votes
3answers
207 views
Scorekeeper for a game
The code is not for any project, I just want to know the best coding practices. The code is also on GitHub.
...
4
votes
1answer
63 views
Implementation of a AVL Tree
I attempted to write a AVL Tree in a functional style and I am hoping to get it reviewed. I am looking for the code to be clear and concise, any opportunity for improvement would be greatly ...
3
votes
2answers
94 views
Print all nodes that are at distance k from a leaf node
Given a binary tree and a positive integer \$k\$, print all nodes that
are distance \$k\$ from a leaf node.
Here, the meaning of distance is different from the previous post.
Here, \$k\$ ...
3
votes
3answers
157 views
Find floor and ceiling in the BST
Find ceiling and floor in the BinarySearchTree. Looking for code-review, optmizations and best practices.
...
1
vote
3answers
69 views
Find all possible interpretations of an array of digits
Consider a coding system for alphabets to integers where 'a' is
represented as 1, 'b' as 2, .. 'z' as 26. Given an array of digits (1
to 9) as input, write a function that prints all valid ...
0
votes
1answer
58 views
Maximum sum between two leaf nodes
Given a binary tree in which each node element contains a number. Find
the maximum possible sum from one leaf node to another.
The maximum sum path may or may not go through root. For ...
-2
votes
2answers
64 views
A struct within a class [closed]
I have a struct lying in a class as below, which I think is not good. Structs should be in a separate file, however, in this case, this struct is only used in a ...
0
votes
1answer
111 views
Check if two nodes are cousins in a Binary Tree
Given the binary Tree and the two nodes say ‘a’ and ‘b’, determine whether the two nodes are cousins of each other or not.
Two nodes are cousins of each other if they are at same level and have ...
1
vote
2answers
56 views
Implementing DAO with SOLID
I might not be keeping with Single Responsibility with my DAO. I also implement a custom observable through update. It makes sense because when something changes in the data, then it makes sense for ...
3
votes
4answers
444 views
Delete duplicates from unsorted linked list
E.g: if a linked list contains 2->3->1->3->4 then the result should be 2->3->1->4. Notice that 3 has been eliminated.
This code is attributed to GeeksforGeeks. I'm looking for code-review, ...
2
votes
2answers
70 views
Find a triplet from three linked lists with sum equal to a given number
Given three linked lists, say a, b and c, find one node from each list such that the sum of the values of the nodes is equal to a given number.
For example, if the three linked lists are ...
5
votes
2answers
143 views
Family finances - tracking and reporting
I am looking for clean way to accumulate amounts within a input dataset. In this example, there are 18 rows of data, and the output is a 3 rows of data, accumulated by Key, by ExpenseType.
My ...
3
votes
3answers
105 views
Delete alternate nodes of a linked list
If the linked list is 1->2->3->4 then the output should be 1->3. If the linked list is 1->2->3->4->5, then the output should be 1->3->5.
The question is attributed to GeeksForGeeks. I'm looking ...
1
vote
1answer
47 views
Remove all nodes which don't lie in any path with sum >= k
Given a binary tree, a complete path is defined as a path from root to a leaf. The sum of all nodes on that path is defined as the sum of that path. Given a number K, you have to remove (prune the ...
1
vote
1answer
75 views
Extract Leaves of a Binary Tree in a Doubly Linked List
Given a Binary Tree, extract all leaves of it in a Doubly Linked List (DLL). Note that the DLL need to be created in-place. Assume that the node structure of DLL and Binary Tree is same, only the ...
3
votes
4answers
1k views
Given only a pointer to a node to be deleted in a singly linked list, how do you delete it?
Example: If a linkedlist list contains 10->20->30->40, and 2nd node has to be deleted then the output should be 10->30->40
This question is attributed to Geeksforgeeks. Looking for code-review, ...
1
vote
1answer
109 views
Should this container be a struct or a class?
I have a class that serves purely as a data container for passing values from a parsing class to a class responsible for saving the data. I have been wondering whether it would be more appropriate as ...
3
votes
1answer
56 views
Getting the index (x,y) of a char in a “2D” list in Haskell
I have this working function circuitFind that I really don't find nice because I feel there is a better and simpler way to accomplish what it does.
...
1
vote
1answer
54 views
Delete nodes in linkedlist whose next node is greater
Given a singly linked list, remove all the nodes which have a greater
value on right side.
Examples:
a) The list 12->15->10->11->5->6->2->3->NULL should be changed to
...
1
vote
3answers
69 views
Check if all leaves are at same level
Check if all leaves are at same level. This question is attributed to geek for geeks. Looking for code-review, optimization and best practices.
...