instruction stringlengths 71 71.9k |
|---|
I have a query in MSSQL, where I get a summary by days from a range in a table, and this is in union with other queries. This query is used to generate days in a specific range, then add the registry per day, and exclude the registry that are equal to others (in this case, count the rows that tipo is 1, and tipo = 0, a... |
I want to standardise the CSS I use, and am leaning towards bem — I know I'll get a lot of benefit from the predictability of its pattern.
I have hacked their formula ever so slightly - I don't include the B part of the classname on child elements. For me this makes the html easier to write, and maintain.
Pure BEM
<ul... |
The program starts at the center of the screen and starts drawing a line in 50ms steps. When the line hits the edge of the terminal it will be reflected and continue drawing. steps takes the number of drawing steps to perform before finishing while until-key finishes on a key press.
Apart from the lack of comments, wha... |
In my application I have code which should run every hour on a new items and execute some expensive operation with multithreading:
int i = 1;
//noinspection InfiniteLoopStatement
while (true) {
try {
Logger.printIterationNum("Text analysis", "beg", i);
Document query = new Document("fetchStatus",... |
I'm building an event recorder. So far the code looks clean, but I feel like I'm missing something that can make this code even better.
Is composition a better solution? If yes, how can I do it properly in this context. Do you know a better way to share the Recorder across all other components? Will it be better to ini... |
The following is an implementation of fixed-length sequences that makes very exotic (and hopefully fun) use of Swift 2.2 types. The question is what exactly is the cost of having the type checker guaranteeing sequence length in this way on safety? performance? readability?
protocol CountType {
static var count: Int... |
This may be rather basic, but I wanted to experiment and learn with some of the upcoming CSS3 techniques. I wasn't able to come up with an HTML/CSS only solution, and I had to work longer than I'd like to admit to get to a point where this menu works as intended on desktop or mobile.
The main lesson I learned is forget... |
I am looking for some useful feedback on my programming. I'm only three days in and trying to improve.
Here is the code:
#include <iostream>
using namespace std;
const double SECT_A_TICKPRICE = 20;
const double SECT_B_TICKPRICE = 15;
const double SECT_C_TICKPRICE = 10;
double getSeatsA();
double getSeatsB();
double ge... |
I've recently made a test. There were four tasks. One of them was to improve following code:
public class FooFileProcessor
{
public void ProcessFile(string filename)
{
Stream fileStream = File.OpenRead(filename);
Console.WriteLine(ReadAllContent(fileStream));
fileStream.Close();
}
... |
I recently took a test. One of the questions was to find problems in the following code and suggest refactoring which can provide adding new formats of data:
public class FileProcessor
{
enum FileType
{
Html, Text
}
public void ProcessFile(string fileName)
{
StreamReader fileStream... |
This code performs integer factoring using the GMP library, and can also use OpenMP for parallel computation.
I compile it using: gcc -lgmp -fopenmp and whatever optimization flags I wish to try.
#include <stdio.h>
#include <gmp.h>
void next_prime(MP_INT *x) {
MP_INT r;
mpz_init(&r);
if (!mpz_probab_prime_... |
Given a URL like this:
localhost:3000/sell-residential/house-apartment-penthouse-size-30-any-for-0-100000-in-miami%3b+orlando%3b/list-1?numRooms=2&numBaths=2&numParkingSpaces=1&misc=photo-only&interiorFeatures=heating%2Clift&exteriorFeatures=garden%2Cbalcony
I would like to extract some values using RegEx. What I have... |
Here is my approach. Unique element means that element should present only once in the array.
import java.io.IOException;
import java.util.Comparator;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.Map.Entry;
public class Unique {
public static void main(String[] args) ... |
This is quite a simple function, but I just wanted some opinions on it, like is this the correct way to run a function and check if an element exists or not?
const button = document.querySelector('.js-brand-video--thumbnail')
const iframe = document.querySelector('.js-brand-video--iframe')
function playVideo () {
if... |
This is my challenge using JavaScript -> Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both. In other words, return the symmetric difference of the two arrays.
My code works, but I think that it can be better.
function diffArray(arr1, arr2) {
var newArr = [... |
I have a challenge, which is to create a JavaScript function that turns a given number into the string representation. For example:
console.log(inToEnglish(15)) should print fifteen
console.log(inToEnglish(101)) should print one hundred one
and so on...
This challenge covers Non-Negative, greater than zero Integer numb... |
I've made integration tests for a major part of my application. I test my dependency injection is set up correctly, creating controllers with it's dependencies going all the way to the database (using localDB) and returning the response. I'm looking for what could be improved.
Here is the general concept of my tests:
p... |
I have this generic "matrix" holding elements of arbitrary type. It supports any horizontal or vertical rotations (of any step size) in \$\mathcal{O}(1)\$. See what I have:
package net.coderodde.util;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.ev... |
I wrote a 3D bin packing algorithm but I am still not sure if it is correct or not.
I did not follow any code or pseudo-code that's why I would like to know if it is an efficient algorithm for the 3D bin packing problem or not.
each container has a length, height and breadth
each item has a length , height and breadth... |
I have an array of strings called theArray. All strings in theArray are of length 20. I wish to display this array in tabular format to view the clustering of a hashing function. This code works, however, it looks horrible. Is there a better way to create tables?
for (int i = 0; i < arraySize; i+=3) {
Sy... |
I have started learning Java recently and was looking into some easy algorithms.
I found the Boyer Moore voting algorithm here.
I am trying to get better at writing good code for my solutions. Please give me your suggestions.
import java.util.Scanner;
public class MajorityVoteAlgorithm {
public static void main(S... |
I am making a multiplayer platforming game, and currently there are server performance issues once I have about 7+ clients connected. I was told earlier last week that I should investigate socketserver since previously I had been writing my own server using merely socket.
Well, after 6 hours of implementation I've got ... |
Am trying to create a minesweeper game, I have the following code which has to many nested ifs, I want to change the code to take out the nested ifs and make it better to read. But I am stuck on how to change the nested ifs. Any help would be great. thanks
/*method to check cells around a cell and set its value.*/
... |
Problem
Given a square matrix of size N×N, calculate the absolute difference between the sums of its diagonals.
Input Format
The first line contains a single integer, N. The next N lines denote the matrix's rows, with each line containing N space-separated integers describing the columns.
Output Format
Print the absolu... |
I have the following function and I was wondering if anyone could come up with something more efficient.
It just has to split both the content and the search string and determine how many words are required to be matched before being true.
For example,
"A dog can run.".ContainsV2("Red Dog Run", 4) = false
"A dog can ... |
I'm writing a Matrix class, and I want to be able to construct a Matrix in two ways:
Supply a 2D array that the Matrix can use internally
Supply the dimensions of the Matrix, and the value to fill each cell with.
In most languages, the obvious solution would be to overload the constructor, having 1 version of it that... |
I have a query against an MS SQL database that takes the resulting dataset and stores it in an Oracle database table which then gets joined to another Oracle table using the column LABEL_YYYY_MM_DD_HH24_MI varchar(32). I have converted the MS SQL datetime column q.InTimeStart as per below.
Is there a more efficient wa... |
I'm currently reading the infamous K&R C book and trying to solve Exercise 1-20. My solution looks kind of too simple, but it works. I've searched the web for different solutions, but they all are much longer, although I didn't see any improvement compared to my code. Do you see anything which might compromise my appro... |
I'm trying to create a function to return a DataTable with the results of a MySQL query where the program doesn't know the names of the queried columns until run-time.
How can I improve the readability of this function? Is concatenating strings like this an appropriate way to generate MySQL queries?
public static DataT... |
I've started using the following Error configuration for some simple libraries I've been working on:
pub mod err {
use std::{error, fmt, result};
macro_rules! from {
($t: ty) => {
impl ::std::convert::From<$t> for Error {
fn from(e: $t) -> Self {
Error::B... |
I've implemented a rather straightforward octree, but I don't feel that good about the coding style or some of the implementation. In particular, I use some nasty void pointers and extra news because I couldn't figure unions out, and I'd like to have that replaced (I'm thinking maybe templating can solve it, but any f... |
A robot can move in one step from cell X to cell Y if and only if the distance between the centers of the cells X and Y measured in meters is equal to the sum of integers contained in X and Y. It then returns the index of the cell which the above condition does not meet which is the index only [0, 1, 4] and its value ... |
When a UITableViewCell has subviews with background color set, when setSelected(_: animated:) gets called, all the views are made transparent.
This issue is also discussed here
I'm trying to solve this issue by extending UITableViewCell
extension UITableViewCell {
private func backgroundColors(views: [UIView]) -> [... |
This is just a simple class that you can you use to send requests and get the HTML code. I would like to get feedback on this.
For your request you can set:
URL
Request method: GET or POST
Request parameters: if you need to pass parameters
Request cookie
As a response you will get:
HTML
Response cookie
Request
clas... |
I'm teaching myself Java and I had some basic questions on how well I am writing my code for readability. I feel like sometimes I'm just writing code that works, and I'm not that proud of myself when I have finished. I'm not asking you to rewrite my code; I'm just asking for some pointers on how optimize my code for re... |
I've been working on the Project Euler problems, so I created a GUI and a Solver class for all the code I've been creating. I'd like to share it with you guys and to get general feedback on my coding and how I chose to organize the class.
You can also give feedback on how I solved the Project Euler problems if you'd li... |
I would like a code review on the coding I did for my assignment. The reason I have asked here is because my lecturer has no intention of going through (Don't ask me why, I asked before and he said no..) and I have no idea if I am doing it right or not.. All my other classmates seems to have different answers too, some... |
I am a high school math and science teacher. I am working with my students on the concepts of algorithms, unit conversions, and functions. In class, to work on all these concepts, we just worked out the process of how to calculate how old someone is in seconds. I thought this was a particularly interesting algorithm... |
Experimenting with vera++ to validate some C++ source files.
https://bitbucket.org/verateam/vera/wiki/Home
vera++ is expandable by providing your own rules in Tcl. To interface with the vera++ parser the following interface is provided:
https://bitbucket.org/verateam/vera/wiki/ScriptAPI
Using the above I have written a... |
Experimenting with vera++ to validate some C++ source files.
https://bitbucket.org/verateam/vera/wiki/Home
vera++ is expandable by providing your own rules in tcl. To interface with the vera++ parser the following interface is provided:
https://bitbucket.org/verateam/vera/wiki/ScriptAPI
Using the above I have written a... |
I know there's a more compact way of doing the following code but I haven't been coding PHP in a while and I completely forgot how. I'm pretty sure it's to do with : and ?'s but I'm unsure.
Basically, if $bind has a value add $bind inside of execute() otherwise just don't.
//Execute Binded Query;
if($bind != false) {
... |
I made some changes to the first code here I wrote and I want to know which one is more correct logically (before the changes or after the changes).
It's really hard to manually test these kind of problems.
This is the first code (without the changes):
public boolean put3D(ItemsUnit item, int p,int n) {
//------i... |
I want to improve my code. In this code I don't like my constructor, but without it I keep getting an error while trying to connect NullPointerException.
package soft;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.swing.JOptionPane;
import net.wimpi.modbus.ModbusException;
import net.w... |
This is the link list I just created. It works fine for now, but would want to know if I could make it better.
list.hpp
/******************************************************************************************************
* Purpose: Custom Doubly Linked-list.
*
* Author: Sahil Arora
*
* Version : 1.0
*
* Date ... |
if (isset($_POST["save-options"])) {
foreach ($names_of_array as $type => $value) {
update_option('updated_img', $_POST['show_img_url']);
if (isset($_POST["post0"])) {
update_option($names_of_array[0], true);
} else {
update_option($names_of_array[0], false);
... |
This is a follow up question to 3D bin packing in Java
I finished testing my code's result and started cleaning it up.
Could anyone please tell me what I should do or fix to clean up this code more?
I'm required to put a comment for every instruction line I write. English is not my first language, so maybe some of t... |
i am just start to learn C++ and would like to know if there is a better and efficient way to solve this problem or some recommendations.
Problem: Remove all vowels from file and create new one without
vowels.
Here is my solution.
#include <iostream>
#include <fstream>
bool is_vowel(char &ch) {
ch = tolower(ch... |
<?php
$mnquery=$ob->showDataall("select * from menus where parent_id='0' and delet='0'");
foreach($mnquery as $value)
{
$selquery=$ob->showDataall("select * from menu_permission where staff_id='".$_SESSION['user_id']."'");
foreach($selque... |
I have to make a user creation wizard, there are 3 steps to achieve the insertion of a new user, so every step I have have a validation function to enable the next step.
As a first step for the following markup:
<div>
<div class="block block-bordered">
<div class="block-header bg-gray-lighter">
... |
I wrote a Brainfuck interpreter in JavaScript, however it is quite buggy and I can't figure out what I'm doing wrong. It works for programs I've written, but fails on most programs I find on the internet. It seems that the while loop doesn't work correctly when it is supposed to skip over. When debugging, the value of ... |
I've a lot of data whit prices of a product from different firms by week. I've a class named WeekPrice witch contains a list of firms. Here you've my class structure.
Here you've a little part of the data in JSON format:
[
{
"ID": 1,
"NumberOfWeek": 1,
"Year": 2016,
"Date": "01/04/2... |
Exploring the VBA Application.InputBox method I've realized that catching user cancellation is tricky when type is reference, so return value is a range object.
As cancellation's return value is False I can't assign it to an object with Set, so I've created a UDF to return Nothing when user pressed cancel / Esc.
Funct... |
I've created the unitofwork class
below:
public class UnitOfWork : IUnitOfWork
{
private AppDbContext _context { get; set; }
private IDbTransaction _transaction { get; set; }
private ObjectContext _objectContext { get; set; }
private bool _isDisposed;
public UnitOfWork(AppDbContext context)
{... |
I am trying to merge JSON objects which have common values.
This is the original JSON:
{
"setA":[
{
"setId":"setA"
,"prodId":"A"
,"price":"5"
,"delivertCost":"1"
,"name":"Set_Prod01"
}
,{
"setId":"setA"
,"pr... |
This code is for calculating the perfect squares between two given numbers. User can add the interval as well like for how many intervals he want to check the perfect squares. For example if user enter 4, it means there are 4 different intervals and after that he will insert the tow number for interval 1, similarly two... |
I am extending std::list in order to have access to convenience member functions that simplify my everyday developments (e.g. ways to deal with doubloons, delete all the stored pointers, etc.). I removed some of these member functions, but I kept the essential ones.
#ifndef __PJ_LIST_H__
#define __PJ_LIST_H__
#include... |
I need to create a class which acts as a paginated list. My use case is like this:
I am writing a library which makes a service call to fetch a List<obj>. Since the List<> can be large, the service expects me to call with a PAGE_SIZE. The service has also provided me with a TPS of x which I need call it with.
I need to... |
I wrote a little function that does, I think, what the Excel function does:
Given a value and a table (matrix), search for the row that has value closest to but not greater than the given value. Returns the value of a column in the matrix.
Is there something I'm missing here? It works but seems too easy.
def vlookup(... |
I am trying to implement an OAuth2 service. I am not planning to use it anytime soon (like will write unit tests). This is my fun project I do to practice. I have used the python_jwt library to create and validate signatures.
OAuth Request handler
"""
Copyright (C) 2016 Maruf Maniruzzaman
Website: https://github.com... |
I have an instance of a Java class that I need to call some functions on, using the API exposed by another party. For each call, I need to both check for thrown exceptions, and check the value of the returned boolean. If the boolean is false, I need to read the errorMsg object to see what went wrong. In either error ca... |
For the nth time already I come back with yet another alien sorting algorithm. Today I will present Melsort, implemented from the description I found in the paper Encroaching Lists as a Measure of Presortedness by Skiena.
Melsort
Melsort is a two-step algorithm: first it constructs a set of encroaching lists, then it m... |
interface IJuiceable
{
void MakeJuice();
}
interface ISliceable
{
void MakeSlices();
}
class Fruit:IJuiceable,ISliceable
{
public string Name { get; set; }
public void MakeJuice()=>Console.WriteLine($"Juice from {Name}");
public void MakeSlices()=>Console.WriteLine($"Slices of {Name}"); ... |
I use this for reversing a string, but it has O(n) :
reverse(y.begin(),y.end());
How can I reverse a string in O(n/2) ?
|
I'm having trouble optimizing the Project Euler problem number 23 :
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
A number n is called def... |
Is there anything I need to add or is this the best security possible?
<?php
//Get Sessions Prepared;
session_start();
//If logged in, Logout;
if(!empty($_SESSION['username'])) {
//Remove Sessions to Logout the user;
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
... |
I'm trying to learn javascript using project euler and I decided to try to force myself to learn about generators in javascript using problem number 2 which asks us to: Find the sum of the even-valued terms in the fibonacci (f(n)) sequence such that f(n) < 4M , beginning with n=1 is 1, n=2 is 2, n=3 is 3 and so on
My ... |
I'm really confused about the interview I did with a firm. They told my code was not expert, but almost intermediate level java.
Requirements
Football Scoring Dashboard
Develop an application that prints out a scoring dashboard as text during a football match. The football scoring dashboard would have output the follow... |
The HexToString function returning maximum of 16kb even for sources greater than 16KB
string HexStringToString(string HexString)
{
string stringValue = "";
for (int i = 2; i < HexString.Length / 2; i++) // Starting from position too just to avoid the 0x Hex Code that messes stuff up
... |
I am creating a color slider, and I'm trying to make the slider's background-color a dynamic gradient. I've successfully did it, but I feel this can be done in a lot less code than what I have.
What I currently have is, I go through every slider (without a loop), and give it the correct gradient. I'm sure there is a co... |
Like those who have come before me, I foolishly have sought to implement a generic, efficient, idiomatic, and most importantly correct method of comparing floating point numbers for equality. Like those who have come before me, I have most likely failed in at least one of those regards. I'd appreciate comments on any ... |
I have a SQL query to find all delivery orders with multiple purchase orders (one-to-many). Is there a better or shorter way to write this?
SELECT * FROM GR_data
WHERE doNo IN
(
SELECT dt.doNo FROM
(
SELECT doNo, po_number FROM GR_data
WHERE DATALENGTH(Mat_No)<=0
GROUP BY doNo, po_numbe... |
This is a question from programming contest. This contest is already over.
Now, all the prime numbers are arranged sequentially in ascending order. i.e:- 2, 3, 5,7...and so on. Now, your task is to calculate those prime numbers which are present at a prime position. For example, 2 is present at position 1 which is not ... |
I am working on an instant chat messaging application. I am getting contacts from phone and displayed them in list view of an activity, but it is taking 25-30 seconds using the following code:
1. On clicking Contact button:
contacts.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(V... |
This code takes a JSONObject, passes it to another class which is responsible for mapping the data in the JSONObject to a different format (Still a JSONObject though).
I'd just like confirmation if the code below is bad practice or not, I feel it is:
public class DeliveredCommunication{
private String deviceId;
... |
##open file and create a dictionary of {"word":"sorted word"}
word_file = open("word_list(1).txt","r")
word_list = {}
for text in word_file:
simple_text = ''.join(sorted(text.lower().strip()))
word_list.update({text.lower().strip():simple_text})
##lowercase and sort the user input word
def simplify_entered_wo... |
I would like to get images from other websites.
This is my current method but I'm not sure if it is alright.
<?php
header('Content-Type: '.image_type_to_mime_type(exif_imagetype($_GET['url'])));
echo(file_get_contents($_GET['url']));
?>
If not, how should I do it?
|
Task
Write a program that, given the amount to make change for and a list of coins prints out how many different ways you can make change from the coins to STDOUT.
My approach
The number to make change for is N. Take one coin C and sum the number of ways to make N - C with the other coins. Add the number of ways to mak... |
Lately, I have been working on this Huffman algorithm and it is finally done, though I think it is improvable due to the fact that people say you have got to use two priority queues but I ended up just using one, so maybe it is even not correctly implemented.
Code:
#include <iostream>
#include <string>
#include <map>
#... |
I have a model called booking.
class Booking < ActiveRecord::Base
has_many :charges
def charge!
raise "Not active" if !active?
c = charges.create()
c.charge!
end
end
However I feel this is not optimal. For example, it would be nice to integrate the activeness checking into Rails' own validation syst... |
I shall make a JavaScript-function which does the same as PHP's array_diff:
http://php.net/manual/de/function.array-diff.php
Because it is intended to use the function as a (internal) library-function I have tried to catch everything which could possibly go wrong concerning incorrect usage.
Moreover I've tried to docum... |
I was trying to do a sample threading program, where the spawning of thread is in a while loop. I DO NOT want to generate multiple number of threads. The while loop should keep on running, irrespective of whether the thread completed execution or not. There is a call to the .get() function of the above thread within th... |
I had to build a responsive component which allows the user to display specific content in a page. I called it the contentToggler.
Here is my component in action
HTML Structure of togglers & contents :
On small screens : <select> with <option>
On big screens : <div> containing <buttons>
<select id="paymentMethodSelect... |
I'm using the following code to parse html, This code is working but since I'm new to JavaScript and working in alone project I would appreciate if you can give me some tips and feedback how can I improve this code,or it is fine...
The requirements are:
Insert a new script after given script ID(in the code after test... |
I'm fairly new to JavaScript and Node and am wondering if I'm on the right track.
Module file:
'use strict';
var chalk = require('chalk');
var config = require('../config');
var moment = require('moment');
var rp = require('request-promise');
var todayDay = moment().format('dddd'); // ["Monday"]"
var todayDate = mom... |
I'm adding an onclick listener to the whole document then checking the source of the click. If the source of the click contains the attribute data-widget I want to go to the appropriate action. I did it but I'm hoping for a more efficient way of doing things and if I can do without the self invoking function.
<div dat... |
This is my first Rust program. I have previously written a lot of Python, and some C. I would like some advice on whether I am doing things idiomatically, and any improvements I could make! I also appreciate any suggestions with regards to style.
The code takes two text files as cmd line args. One file contains an ... |
I'm learning bash and my goal here is from any repository on my computer to be able to type github and it will open the remote in a browser for me.
This works but I feel like I over complicated the remote=$(..) logic and arguably the get_ext() method.
get_ext() allows you to type github issues and it will open the issu... |
Recently I have been doing a bit of work with Contact Form 7 and Wordpress. I've begun looking at form validation using jQuery and I've been trying to write a script that is as efficient as possible.
I'm wondering if someone could take a look at my code here: https://jsfiddle.net/javacadabra/6mpo9h9z/4/ and let me know... |
This Greasemonkey script adds links to tags on StackExchange sites which allow for activating, deactivating and ignoring favorite and related tags by using UI components.
Since JavaScript is not my favourite language I'd be glad to hear what can be done more elegant, more beautiful, more performant, etc. (also by using... |
I am new in Go and for study I have to hold a presentation about concurrency in Go. I think the Golang Tour - Webcrawler exercise is a nice example to talk about that. Before I do that, it would be nice if anybody could verify if this solution fits. I assume it is correct but perhaps I have missed anything or any of yo... |
I have used a HashMap of ArrayLists to maintain the nodes at each depth.
Also i maintained a depth at each node in the binary tree by using a HashMap that stores . While traversing the tree in a breadth first manner, store the depth of each node(just one more than the depth of its parent) in the hashmap and add the nod... |
The task is to find the top two elements from the array without sorting. how can we achieve it? Can we use any DS to achieve this? Say tree? Please pour in your suggestions.
Between, iterative way of solving the problem is also one way. I have done that. Below is the code. I will also welcome if the below can be custom... |
I have the following code that will skip certain URLs if needed:
SEARCH = "inurl:index.php?id="
def get_urls
puts "Searching for possible SQL vulnerable sites, using search query #{SEARCH}"
agent = Mechanize.new
agent.user_agent = @user_agent
page = agent.get('http://www.google.com/')
google_form = page.form... |
I'm looking for general feedback on this module. Here is what it handles on the page:
This is a private "class" meaning none of its properties are available outside of it.
init is run at run-time. pre sets up parameters to be sent to the server via ajax and post receives the ajax response.
I can post the code for Cl... |
I have a program which is designed to be highly parallelizable. I suspect that some processors are finishing this Python script sooner then other processors, which would explain behavior I observe upstream of this code. Is it possible that this code allows some mpi processes to finish sooner than others?
comm = MPI.COM... |
I wanted to get some stats on who has done the most edits on Code Review, so I wrote the following query on SE Data Explorer. All improvement suggestions are welcome.
Note that I used a cursor to partition top users by year because at first there was a fundamental flaw in my logic trying to get the top users overall a... |
I am looking for feedback on my implementations of Queue, Stack, and LinkedList using Java generics. I would very much appreciate feedback on what I can improve and any errors I made.
LinkedList
public class LinkedList<T> {
private int size;
private Node<T> head;
public LinkedList() {
this.head =... |
As a first step in learning Haskell I am solving this problem, which involves finding the Rith-ranked numbers, given some input list and many Ri. In an imperative language I would make a zeroed array c of length 200, increment c[h] for each height h, compute cumulative sums of c and then binary search c to determine th... |
I came across a coding challenge that looked something like this (recreating from memory, sorry)
Suppose you have the following interface for a linked list. Implement an efficient and correct copy constructor.
template <typename T>
class SillyLinkedList {
public:
SillyLinkedList();
SillyLinkedList(const Sil... |
Define a procedure that takes three numbers as arguments and returns the sum of squares of the two largest numbers.
I'm using just the machinery that was developed so far in SICP to be true to the exercise. My method works as far as I can tell -- I tested it for a number of cases and tested different permutations of... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.