0
votes
0answers
27 views

Finding the longest unique sub-string in a string

I recently interviewed with a company for software engineering position. I was asked the question of finding the longest unique sub-string in a string. My algorithms was as follows: Start from the ...
1
vote
1answer
12 views

O(n) Fibonacci?

I attempted to write an \$O(N)\$ Fibonacci. ...
1
vote
3answers
45 views

Optimizing simple prime number function test

For my first basic project with functions, I wanted to make a program that would allow you to input a number, and it would output whether it was prime or not. For the most part, it's functional and ...
3
votes
2answers
26 views

Simplify a fraction

I have been learning Python for a while (my first programming language) in my spare time. Since it's been 20 years since math class, and I didn't get very far with that, I just brushed up on ...
0
votes
1answer
15 views

Converting integers to strings

I drafted a method that I intend to use to convert integers to strings. Is there a way to make it faster? Are there any "simple" changes I could make to improve its performance? This cannot be done ...
0
votes
0answers
7 views

Modular Exponentiation

I want to solve the following in Python: x^101 = 8765 (mod 9691573) I coded this: ...
-1
votes
1answer
26 views

Most common words in a text file [on hold]

I've made a program that outputs you the most common word in txt file. Does anybody know how to optimize it so that it would work for bigger files and run faster? ...
2
votes
3answers
47 views

Copying one array to the end of another array

I wrote a program that places values in one array to the end of another array. It keeps the order of the values. If the second array is bigger, then there will be leading zeroes. Is there anything I ...
4
votes
3answers
120 views

Guess the number game

I just started to learn Java and had to write a "guess the number" game. Could you please review and give me some feedback? ...
7
votes
2answers
135 views

Find the number of working days between two dates inclusively

The objective is to find the number of working days (days spanning from Monday to Friday) between two given dates inclusively. ...
3
votes
1answer
23 views

Circular Buffer implementation in Ruby

Does the implementation look correct? Did I miss something major/minor? ...
0
votes
0answers
30 views

Unrolled linked list with iterator [on hold]

I'm making an unrolled linked list (linked list with an array of 50 in each Node) for a class project with an iterator. In addition, whenever more than half of the arrays are unused (they would all be ...
5
votes
1answer
80 views

Iterative Fibonacci sequence using standard library functions

We're all aware of Fibonacci sequence calculators but they look like C-style code. I want to avoid that and take advantage of the standard library. This code is very short, so I'm focusing on ...
2
votes
0answers
18 views

Perfect elimination ordering and high memory usage

The following code calculates a perfect elimination ordering in a special case in Haskell. I am less worried about its correctness than its high use of memory. The following code runs out of memory ...
7
votes
1answer
124 views

Top-down movement

I've been working on a Final Fantasy-ish game and am leaning toward more like 1 - 3. This is my attempt at map movement. It does work, but if anyone has any suggestions or critiques, I would like to ...
4
votes
1answer
80 views
3
votes
3answers
153 views

Double Linked List remove method

I am implementing some basic data structures to freshen up my memory and I wanted my DoubleLinkedList remove method to be reviewed. I feel like it has extra checks ...
2
votes
0answers
28 views

Loading screen animation

I am trying to make a loading screen but my code isn't DRY. How could I make it DRY? I have thought about using CSS3 keyframes but I might have problems cross-platform. ...
1
vote
2answers
65 views

DFS on a binary tree: marking nodes as visited

I wanted to write depth first search reversal iteratively in Java. Can someone review my code? I'm not that much interested in naming of the variables, but in the structure of the code, i.e. I don't ...
-3
votes
0answers
49 views

C++: What would be the preferred naming convention for open source lib [on hold]

I am going to release an open source C++ lib. I use snake_case for all classes and functions but seems CamelCase is more popular amongst open source projects. What notation would be preferred ? ...
3
votes
1answer
30 views

Calling new classes

I have a switch in the index.php file. When there is a value in the $_GET['page'] and it matches the switch it includes a page, ...
0
votes
1answer
23 views

Java package organisation [on hold]

I am not really sure how to organise my Java packages, for example let's say I have these classes: Vehicle.java ...
-1
votes
0answers
38 views

Create a graphic nodes without a lot of dynamic casts [on hold]

We (the team of developers) write a small game for iPhones. We have an architecture, where the logic of the game entities is separated from their view on the screen. When we create an object, that ...
2
votes
2answers
80 views

Evaluation of a solution for Run-length encoding algorithm

I wrote an answer for the following question and wondering if there is any better approach to it. Using the Java language, have the function RunLength(str) take ...
7
votes
2answers
141 views

User-defined class for a box

We have just learned about classes. Please help me improve this program. I created a class called Box with members that represent its dimensions. Then I calculate ...
3
votes
2answers
32 views

Using Custom Attributes to Populate Members from IDataReader

Just learned how to use custom attributes in C# and the first useful thing I did with it was to make a class object representing a database table. The constructor can accept an ...
2
votes
3answers
49 views
3
votes
1answer
27 views

How to avoid mounting SQL by concatenating strings?

I found myself mounting a query by concatenating strings. This just seems wrong. Any ideas of how to avoid this kind of situation? I'm using Rails 4, and I don't see how can ...
-1
votes
0answers
17 views

Caesar Cipher - JavaScript encode function return is undefined [on hold]

I am not sure if my code is right, but it is returning undefined. I think the problem is right here: http://jsfiddle.net/qjdxj2y2/ return text.innerHTML = ciphertext; I don't know what to return, ...
0
votes
0answers
16 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. ...
4
votes
2answers
57 views

External bottom up merge sort too slow

My external sort function works but it is way too slow. I think the bottleneck is the merge function. How can I make it faster. Is there a better merge function I can use for merging into a file using ...
3
votes
1answer
32 views

Turning JSON objects into custom NSObjects

Was advised to post this question here after posting to Stack Overflow. I'm pre-populating a UITableView app with data using a local JSON file. The JSON itself is very simple: ...
2
votes
1answer
24 views

Toggle-item inside a Bootstrap dropdown-menu

I have this working code for a toggle-item inside a Bootstrap dropdown-menu. See demo here. I suspect that it should be possible to improve it : in order to have a shorter code and avoid all the ...
4
votes
4answers
160 views

Delaying execution of a function [on hold]

I have an object with an arbitrary number methods and a property indicating whether it is ready or not. The methods can be called before the object is ready, but should do nothing until it is ready. ...
-1
votes
2answers
57 views

Operating on files from source directory [on hold]

I have a small program that does a fairly trivial task. I am unhappy about the fact that I have everything in Main or called from ...
3
votes
0answers
12 views

Using record variant for register mapping in Ada

It is OK to model a double usage register with a record variant: ...
2
votes
1answer
17 views

Dynamic “filtering” list using jquery

I'm building a list of filters for a website user to filter on, such as a product category page. I'm giving the user the option to filter on brandname, model name, or gender. To avoid serverside code ...
0
votes
0answers
28 views

A game similar to Tic Tac Toe using graphics and java OOP [on hold]

I am working on a game that my friends invented - a little variation on tic tac toe: using a 4x4 board, one player (x) need to get 3 x's in a particular manner while the other can place one 'z' and ...
-3
votes
0answers
31 views

Is my algorithm correct? [on hold]

Given a set S of m strings and a target string t we want to check whether or not t is the concatenation of some of the m strings while allowing repetition. Example : S= {ab, dbe, eaa, ea} and ...
8
votes
4answers
736 views

Pig Latin in Java

I've done my second application in Java now. I want to know if: This code is efficient This code can be written in a shorter and faster way Any flaws Any misuse or better use of concepts Main ...
2
votes
1answer
33 views

Optimizing mcrypt encryption class further

The following is a very simple implementation of an Encryption class using mcrypt whereby the functions encrypt and ...
4
votes
1answer
24 views

Python DictionaryTagger class takes too long to initialize

With big inspiration from code from different webpages, I have created this DictionaryTagger. My problem is that it takes around 2 sec. to initialize the taggers / ...
1
vote
1answer
192 views

Reversing a String in Java

I'm new to Java and I want to know if this code is efficient, and if there a shorter and faster way to reverse a string. ...
8
votes
3answers
92 views

Basic string compression counting repeated characters

My task was to implement a method which performs basic string compression by counting sequences of repeating characters. Given "aaabbbccc" it should return ...
7
votes
2answers
104 views

Compute the number of molecules

I would like my program to be reviewed. I had to write a simple program that calculates the number of molecules in a hydrocarbon. 1 carbon atom has 12 AMU. 1 hydrogen atom has 1 AMU. ...
5
votes
3answers
52 views

Windows forms set saved groupbox location settings

I have a Windows form that when a user moves some groupboxes around, before the application exits, it saves those X and Y coordinates into a MySQL database (with a bit of added text to identify which ...
5
votes
1answer
29 views

Console application - customizer bootstrap style

I've created a console customizer for a C# console application. This is not finished yet but I'm looking for tips, requests and suggestions so I can make some updates. Sample Preview The ...
2
votes
1answer
23 views

Simulating Natural Sorting in MySQL with PHP

I have a MySQL table which contains product SKUs among other things. PHP powers importing data into this database, managing data through a control panel, displaying the information on the front-end, ...
0
votes
0answers
21 views

Using Rvalue references and Simple Factory [migrated]

I recently learnt about std::move and rvalue references, and want to know if my usage of them is both appropriate and efficient. ...

15 30 50 per page