instruction
stringlengths
71
71.9k
In this code: tmr represents timer array n represents number of frames in memory m represents number of pages rs represents the reference string There are many functions in this program, but the important one is the timer_confg. This is the function that tests the particular page refereed is least refereed or just re...
I've to authorize some users to do POST requests from their CMSs in order to create a new resource on my database. I've to send a JSON response containing the status of the response (successful or not), and on failure, send an array of the errors. To not continuously repeat the return statement (i.e. return response->j...
today I created a simple hangman game, which has 10 different categories with 10 words each. The words order is being randomized each time you pick a category. You have the chance to pick a wrong letter 8 times, after this it's game over and your progress on the current category is being wiped out. The game also saves ...
I'm curious how I can improve the readability of this short program I wrote. Mainly, if and how there is a way to remove the for loops and maybe refactor the getTruncatedSubListsOf methods to one method since they are pretty similar. I tried using comments only when clarification was necessary. import java.io.IOExcepti...
I just wrote this script that calculates the time difference between two times. It's going to be used in a larger program that will store the returned value in a database. I'm mainly wondering if I've used docstrings, comments and try/raise/except correctly since it's my first time really using them. def time_differen...
I was wondering if someone could help me refactor this code. Although I know this looks bad, it works. Now I would like to refactor it so I would respect the open/closed principle in SOLID. Let's say the client wants a new search field to search data on, then I need to come to this method and add it in and this breaks ...
In short, what this script aims to do is take the following data: 1 Alpha Beta Delta 2 Beta Echo Foxtrot Kilo 3 Alpha Kilo 4 Beta Echo Kilo Zulu And re-arrange like this: 1 2 3 4 Alpha Beta Alpha Beta Beta Echo Kilo Echo Delta Foxtrot Kilo Kilo Zulu The...
I am creating a volume converter. It allows users to enter a value and select the unit to convert from and the one it will be converted into. It uses a <select> tag for user input selection. The <select> looks like this: <select name="from"> <option value=0>--select--</option> <option value=1>cm3</option> <option...
I know this question has been asked before now but in Python. Recently, I set out to write an anagram in C#. For instance, orchestra can be rearranged into carthorse and the anagram should not have more repeated than the original. The function is meant to check if the two words are the same and return true in this case...
I have a small function which checks if the given String has all 0's. This method would be used quite often and want to know if it's effectively written. Any help would be greatly appreciated. /* * Input parameters: Employee Number * Returns true if sum of employee number is greater than 0, * else false. */ privat...
I wrote a simple Python simulation to answer the "Amoeba" population question posed here: A population of amoebas starts with 1. After 1 period that amoeba can divide into 1, 2, 3, or 0 (it can die) with equal probability. What is the probability that the entire population dies out eventually? The script seems to wor...
So I have implemented three linear time (\$\mathcal{O}(V + E)\$) algorithms for finding strongly connected components of a (directed) graph. A strongly connected component is just a maximal subset of nodes, such that any node in the subset can be reached from any other node in the subset. The algorithms I am comparing ...
I am new to Swift and I am trying to use the optional binding feature in as efficient way as possible but I am a bit confused on how to use it (if I can) in this scenario: var jsonData:AnyObject? = nil jsonData = try? NSJSONSerialization.JSONObjectWithData(data!, options: []) if(jsonData == nil) { print("Could not...
I am writing a function that, given a list and a target sum, returns zero-based indices of any two distinct elements whose sum is equal to the target sum. If there are no such elements, the function should return null. For example, FindTwoSum(new List<int>() { 1, 3, 5, 7, 9 }, 12) should return any of the following ...
I'm beginner with CMake and C++ compilation but it's seems that unlike Java I need to be very explicit with my CMakeList.txt in order to link src with correct header and libraries in my project. Here is my CMakeList.txt cmake_minimum_required(VERSION 3.4) project(AwesomeScheduler) include_directories(header) set(CMAK...
I have a WinForms MVC application that uses Ninject for it's Dependency Injection (DI) / IoC Container. I have build quite a nice framework that allows the main shell (which uses a Docking Container to house an manipulate windows - like Visual Studio), to manipulate IDocument types (actual documents .txt, .xlsx etc.) a...
My makefile looks like this and I translated it to cmake: CC = gcc GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags) CFLAGS := $(CFLAGS) -L/usr/local/include/ -L/usr/include -pedantic -std=c99 -Wall -O3 -g -DVERSION=\"$(GIT_VERSION)\" -ledit -lncurses LDIRS = -L/usr/local/lib -L/usr/lib LIBS =su ...
I have several lists that contain Part objects with a partNumber and quantity. When the user selects to add a part to an existing list, I want to check to see if the part is already on the list. If it is, I simply want to add the new quantity to the existing quantity, and if the part is not already on the list, I want ...
I was recently tasked with architecting a user/profile object in Objective-C and wanted the ability to access a static instance from the class level, similar in style to the way Parse manages their current user (a static variable on a class, not a singleton). With Parse, I can call a class method to return the current...
This is a follow-up on my previous post. I have made modifications based on the feedback received on the previous post, hence I request a third (final?) review on the modified code if ok. Note: review purpose is just to check good practices (code / performance wise) and see if anything's missing. I did all updates as ...
Problem statement: Calculate the date of meetups. Typically meetups happen on the same day of the week. Examples are the first Monday the third Tuesday the Wednesteenth the last Thursday Note that "Monteenth", "Tuesteenth", etc are all made up words. There was a meetup whose members realised that there are exactly...
I just made my first pygame program, ChickenDodger, and I would like to know how I could make my code better. I think I did pretty good for my first time, except the way I added the 2nd egg. I do not like the way I added it. Any advice? (I made a lot of comments for my younger brother, so he understands it easier, I th...
I'm quite new to trying to write my own macros and I've been able to piece this one together, but it takes quite some time to run. Here is the macro for one value (I have to create workbooks for ~20 different values). Are there any ways I can improve its speed? Also, I am assuming I can just replicate my For/Next loop ...
I have created a Matlab Simulink model with a series of dot products. Embedded Coder generates a for loop for each dot product, as evidenced by this excerpt of the generated output: /* DotProduct: '<S3>/Dot Product1' incorporates: * Inport: '<Root>/LngPwr' */ EPAR_SPAF_dot_B.DotProduct1 = 0.0F; for (temp_ = 0; tem...
Mat told me to create a struct create a struct for the individual commands and arguments. It should have something like the "executable" name, number of args and arg list. Create a few functions to create such a struct, free it, and add to the argument list So i did. struct str_list { char *const *name; ...
Based on this question and this answer, I decided to try the enum approach to do some more conversions I need in my application. This time I required to convert between the different field naming conventions I use in my application: SQL naming convention (used for my field names in SQL DBs): field_name. Java naming co...
Despite looking terribly ugly, it is pretty interesting due to some specific connections to cellular automata theory. I'm looking for ways of simplifying it further. This program takes 2.7 seconds to run on my machine. Is it possible, by merely changing the logic / control flow on magic, to speed it up? How fast can it...
I've made an Arduino program to run on my Teensy 3.1 board. It accepts characters and strings sent to a Bluetooth module (BC417) from any Bluetooth-enabled device and uses these to power certain pins on my 8x8 LED matrix. I believe the code works, but I haven't been able to test it fully yet. I'm hoping (if it's the ri...
How would you merge these two functions into a single more generic function? // concatStringsFromObject :: Object, Array, String -> Strings const concatStringsFromObject = (o = {}, a = [], j = ' ') => { return a.filter( x => o.hasOwnProperty(x) ) .map( x => o[x] ) .join(j); }; // concatStri...
I wrote a Rails model instance method that checks many separate conditions, and returns a single boolean. It does not employ any nesting of branching structures. Each check has its own comments describing its reasoning. Every check is necessary for the method to return an accurate value, and none of the checks are like...
The below code I have written is to allow me to Sum the results data for every year from 1 to 1000 over a range of 5000 locations. although a 1000 years seems extreme, for the application I am using this makes sense. Column K in the Class Calculation Sheet calculates the Data size for every year for a specific class. I...
Please help review my code. public class Maze { // question: give a maze. Find shortest path from left top corner to right bottom corner. // 1 is wall. cannot go thru. int minFoundLen = Integer.MAX_VALUE; int m = 0; int n = 0; public void findPath(int[][] mazePlan){ if(mazePlan.length =...
The class Functions can store/load any functions. It does this by assigning a unique name to every function that gets added. You can then call the function by specifying its name and return type. Here is a sample usage //Create class Functions funcs; //Add 2 functions (foo -> void(int, int) | add -> int(int, int)) fun...
I have written a ScreenVideoCapture class that implements an interface for capturing frames from a specified monitor connected to the PC. It uses OpenCV structures (including a cv::Mat for image output) and implements the core of the methods that OpenCV's VideoCapture has so that they can be used mostly interchangeably...
I have this little piece of code which determines the base URL of PHP: $root = $_SERVER["SERVER_NAME"]; if(basename(__FILE__) !== trim($_SERVER["PHP_SELF"], "/\\")) { $root .= "/" . basename(__DIR__); } This is working for me, but are there other solutions for this "problem," or are there any cases where this woul...
I needed a deque who's maxlen can be set again after it has been initialized. So, since new-style classes in Python are treated as types, I decided to create a new class borrowing from deque to accomplish this. My approach is to have an internal deque as an attribute and when maxlen is set, it replaces the internal deq...
I am trying to get into the habit of solving programming puzzles in my spare time but am stuck on the first one (which I know can be for a large number of reasons, hence my posting for help). Shown below is my code that is meant to solve the 3n+1 Challenge: from sys import stdin def main(): curr_Line=stdin.readlin...
There is a large list of email addresses and there is a limitation of max 100 email addresses to process once. This is the code I have written. //Create a list of email addresses to test List<string> emails = new List<string>(); for (int i = 0; i < 10000; i++) { emails.Add(st...
For couple of days now I am trying to speed up my Force-Directed graph implementation. So far I've implemented Barnes-Hut algorithm that's using octree to decrease number of computations. I've tested it multiple times and number of force related computations is indeed drastically decreased. Below is the plot of computa...
I have made this app to get a bit more familiar with JavaScript and CSS. I functionality seem to work as expected. Although I've noticed problems with the flexbox-layout in Firefox. Currently no good idea what causes that issue. Any tips how to improve the app appreciated. var sc = {}; sc.btns = document.querySele...
I'm new to unit testing, and to learn, I've decided to "contribute" to Monogame to help with their testing efforts. The issue at hand is to test the input device classes. I've started with the GamePad class. Here are the tests that I have implemented. namespace MonoGame.Tests { [TestFixture] public class GamePa...
I am really new at this and I was wondering if there is a more efficient way of writing this code, which converts time format to 12-hour from 24-hour format, and vice-versa. For example 07:16:35PM converts to 19:16:35, and 13:05:25 to 1:05:25PM. public static void convertTimeTo24(String time) { if(time.substring(8...
I’ve been working on a Rampart inspired multiplayer game for a few weeks now, and it is finally in a playable state. The big thing left to do before going alpha was to add a tutorial to the game. I did a tutorial once before for my city building game, but I was very unhappy with how I coded it. I had a Tutorial class ...
I wrote a download function and I wanted to know if my code clean, readable and maintainable, or if I could make things easier. Please tell me if this function could be used in the real world. public static void Download(Uri _downloadUri, string _path, string _passedSong, Song _currentObj) { if (_downloadUri !...
I have the following models: class Donation(models.Model): donation_amount = models.DecimalField(max_digits=9, decimal_places=2) donor_name = models.CharField(max_length=200) class Charge(models.Model): donation = models.ForeignKey(Donation) error = models.TextField(null=True, blank=True) And I have ...
I was thinking to rewrite my Python code to C++ since it contains quite a lot of simple loops. I was stunned to find out that this critical part of code (the code below) is about 5 times slower than the Python code, and I'm hoping you could help me figure out why. The context is some kind of game similar to Tetris, whe...
I'm trying to learn programming with python by myself and I've made a hangman game for exercise purposes. import random words = ['egypt', 'automobile', 'world', 'python', 'miniority', 'treehouse', 'friend', 'program' , 'people'] def start(): print "Hello! Welcome to a tiny hangman game that I made for exercise pu...
I hope you can get me out of my current predicament which involves coding style when it comes to appending many elements in a pretty flexible and typesafe way. Now I see my code below and I feel that it can be written in a more compact and shorter manner, especially in my set function. Also, I'm not sure if I should me...
Problem Statement: Write a program that cleans up user-entered phone numbers so that they can be sent SMS messages. The rules are as follows: If the phone number is less than 10 digits assume that it is bad number If the phone number is 10 digits assume that it is good If the phone number is 11 digits and the fi...
I've got this fizzbuzz project I am using for a blog series, among other things. In this version, the fizzbuzz function is fed from a Fibonacci generator. I'm particularly concerned with the efficiency of the Fibonacci generator, but all scrutiny is welcomed. Here is a link to the entire project, but below are the part...
Is there a one-liner that can accomplish this same thing? Essentially I have two dataframes: one that has my raw data (data), and one that has values that I want to lookup (lookup). I want to find the percent of values in data (by 2 factors, Site and variable) that are less than the lookup value for those same 2 factor...
I'm trying to remove the duplicate from the list and count the list after removing the duplicates seq = [[1,2,3], [1,2,3], [2,3,4], [4,5,6]] new_seq = [[1,2,3], [2,3,4], [4,5,6]] count = 3 My code takes around 23 seconds for around 66,000 lists in a list How can I make my code faster? def unique(seq): new_seq =...
I wrote the following code in Angular as to accomplish a technical test for a UK job. My impression was that it is very neat and well object oriented. To my big surprise, they rejected it. Could someone find any problematic points as to ameliorate my coding performance? angular.module('myApp', []). controller('myC...
After comparing my newbie attempt with other people's answers, I have a couple questions: I've made s1_set the size of s1. I've seen other people assume that the strings are ASCII-256 and use s1_set(256) but to me this doesn't make sense. Won't s1_set have at most s1.size() bytes (and fewer if s1 has duplicate charact...
I have a small console application that runs a very long task and I would like to hide the console window when I click on the minimize button but keep a notify icon in the system tray so that I would know when the task is completed or something went wrong. Well, I did a lot of research mostly here on SE and I came up w...
I am interested in hearing opinions on this. I need a way to dispose the old value of a property in a way that's compatible with BindableBase. Specifically, I have a few bound properties of type System.Drawing.Bitmap. Am I going about this all wrong? using Prism.Mvvm; using System; using System.Runtime.CompilerServices...
This is an odd case scenario, but I would like to display a message that tells if indexedDB is not supported or if it is removed due to being in private mode (yes ie10+/edge remove indexedDB in private mode, crazy uh?). I think found a way without doing crazy UA sniffing or documentMode hacks that I think could work. ...
I've been tasked with giving a legacy codebase some love. The actual code is written in C, but is not very relevant aside from the #includes each file makes. No, the bulk of this task involves GNU Autotools. Project hierarchy . ├── AUTHORS ├── buildall ├── ChangeLog ├── configure.ac ├── COPYING ├── include │   ├── Ma...
I'm implementing the Binary Search Tree data structure in Swift. It looks like this: class BinarySearchTree<Key: Comparable, Value> { let key: Key var value: Value var left, right: BinarySearchTree<Key, Value>? init(key: Key, value: Value) { self.key = key self.value = value } ...
I have written a simple Tic Tac Toe game in WPC C#. I am just a beginner and learning. Could you tell me if there is something wrong with my code / could be done better? I am pretty much satisfied with how it works, but I´d like to know if I made some things, that could have been done better. Thanks in advance. In the ...
I'm working on unlocking feature: public class UnlockManager { private static UnlockManager instance; public static UnlockManager Instance { get { if (instance == null) { instance = new UnlockManager(); } return instance; } } ...
Currently I have the following callback system: var saveTask = function(err, result) { if (err) return callback(err, result); var newid = mongoose.Types.ObjectId(); var task = new Task({ _id: newid, taskname: req.body.name, teamid: req.body.team, content: req.body.content, ...
I have written a simple linked list visualization program in JavaScript: I am just a beginner in html5 canvas. I am pretty much satisfied with how it works, but I´d like to know if I made some things, that could have been done better. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" con...
I have written this code which basically sorts the array using bubble sort, however, I feel it is not very readable. Please let me know me how I can improve this code. public class BubbleSort { public static void main(String[] args) { int arr[] = new int[] { 4, 1, 8, 5, 2, 0, 4, 3, 7, 9 }; for (i...
My application needs Field objects, which encapsulate 1D, 2D or 3D gridded data. The number of dimensions and their size are known only at run time. Furthermore, I need the encapsulated data to be in one contiguous memory block for performance reasons. I've based my code on the following code, which defines simple mult...
Problem: Write a small archiving program that stores students' names along with the grade that they are in. In the end, you should be able to: Add a student's name to the roster for a grade. Get a list of all students enrolled in a grade. Get a sorted list of all students in all grades. Grades should sort as 1, ...
I have finished the first part of my project, i.e., getting a full working program. However, the performance is not too impressive. The function expectedCosts(state const &S) took around 96% of the total running time, so any performance increase in this function might be worthwhile. For profiling purpose I used a reas...
Last day I implemented the Hunt and Kill algorithm in JavaScript, using HTML5 without any libraries. I would like my code to be reviewed. How it works I start with a 2D array filled with walls (1-s), then I pick a random point in it, and mark it as visited. First, I get all unvisited neighbors of that specific cell, th...
I made a small Poker program with C but I believe I could've written it better. Full source on bitbucket.org int checkhand (struct Card_s * hand) { assert (hand) ; //struct Card_s *suithand = sorthand(hand, true); // Unnecessary struct Card_s *sorted = sorthand(hand, false); /* check for flushes */ ...
I was working on the last days with threads and I didn't want to use ugly methods like Abort(), etc. So I did a simple class which does use one of the most performant and better alternative to Abort(). The class is named as CThread.cs which would stand for CleanThread.cs. Class code: using System; using System.Collecti...
tl;dr The purpose of the code is to allow writing constexpr auto x = std::uint16_t { UINT16_MAX }; constexpr auto y = std::uint16_t { UINT16_MAX }; static_assert(multiply(x, y) == 1u, "broken math"); in a portable way that won't invoke undefined behavior. If that is enough for you to understand the problem at hand, ...
I have a list of candidates which looks like this: candidates = [ { 'name': 'John', 'rank': 13 }, { 'name': 'Joe', 'rank': 8 }, { 'name': 'Averell', 'rank': 5 }, { 'name': 'William', 'rank': 2 } ] What I want to do is semi-...
I have implemented a std::function-like class, that is optimized for storing lambdas, that never copies the stored function, that has a small buffer to store small functors, avoiding dynamic memory allocation. is designed to be sized to exact multiples of a cache line, because the functors will probably be accessed ...
I am a beginner playing around with Python and Tkinter. I wrote this program to draw random names given the students in my classes. I tried to follow PEP 8, but I was wondering if there are any stylistic problems here and also if there is any way to condense the code without affecting the working of the program (as I'v...
Please review my ini file parser (and potentially some general config file formats). The data structure used is a section, see below. Does that seem a good approach? I was wondering about the name. It will parse ini files ok, but unix config files are so variable that calling the class config might be over selling it...
I have the following code for a peak finding algorithm in Python 3.4.3. A peak is an element that is not smaller than its neighbors. def peak1d(array): '''This function recursively finds the peak in an array by dividing the array into 2 repeatedly and choosning sides. Complexity: O(log n)''' ...
I would like some feedback on my solution for the trip programming challenge. Please go through my code understanding that I am interested in interviewing for a dev position at some point and am also interested in competitive programming (I'm just getting started): ''' @author: Teererai This code is intended to calcul...
This is a function that is the building block of one wordpress plugin. I came up with this code after some search but i need to optimize it and get any info from more experienced guys. public static function afz_encrypt_decrypt( $action, $string ) { $output = false; $encrypt_method = "AES-256-CBC"; $secret...
I have a working Java implementation of Bloom Filter. These are the methods to addElement and check for an element. private void addElement(byte[] element) { if (null == element) { throw new NullPointerException(); } long hash1 = Integer.toUnsignedLong(Murmur3Hash.murmurhash3_x86_32(element, 0, ele...
I have tried solving Project Euler #54 in Python. Please see description here -> Description: The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's ...
I made a simple file-encryption utility application for a little school project. I'm really interested in cryptography, and tried my best while making it. Can you see it, and give me feedback? The input is always a FileInputStream (wrapped by a BufferedInputStream), and the output is a ByteBufferOutputStream, which wi...
I am a beginner in Python and PyGame and wrote a memory game. I think there are lot of things I could have done better. I am looking for some advice on how I can improve the design and refactoring of the code. # the imports import pygame import random from itertools import product from pygame.locals import * from pygam...
This code is supposed to implement RFC 3394 which also described in this PDF at page 11. Are there any weak places or formatting issues in attached source? Or maybe some places are not explicit enough? void wrap( const unsigned char *key, const unsigned char *plaintext, unsigned int plaintext_length, unsig...
How can this script be optimized? def processor(n): """Finding the factorial of a given number. """ if n == 0 or n == 1: return 1 product = 1 for i in range(1, n + 1): product *= i return str(n) + '! = ' + str(product) def guardian(): """Asking for a number and guarding the scri...
This recursive calls reverseList on each node of the linked list. When returned from the function call, it changes the next link to the previous node. public static Node reverseList(Node curNode , Node prevNode , Node reverseListHead) { //empty list if(curNode == null) { return null; } //nod...
I'm learning clojure ref types and was trying to make a robust counter generating function. Is there any error or improvement on the code? is there a simpler way? (I want the function to be thread-safe) (defn get-counter [] (let [a (agent 0)] (fn [] (let [p (promise)] (send a (fn [old] ...
This is a second rev of this SE Question. How can I add more validation to this .ico file downloader? It works but I need a way to check the integrity of each step: Check Default location ( checked length is greater than 20 ) ( broken for test.com ... why ? Check Google API ( validation already added ) Scrape page for...
Abstract For the past week I have been looking at taking advantage of the .NET 4.5 improvements to code signing and XML signing to produce a licensing subsystem I can use to license my own products. I now have the thing working pretty well, and I am looking for input as to how it could be improved, or what security iss...
The code performs bubble sort on the basis if any swaps has been performed in the iteration. I made it sort of independent of number of iterations as in any conventional bubble sorting code. I went on pretty much with what I understood from the cs50 class. This mechanism looks more intuitive to me. What improvements I ...
This is an attempt at a fast "document distance" implementation in C++. For reference, I found this problem in MIT's OpenCourseware 6.006 algorithms course. A quick look at the callgrind output shows that my performance killers are, in order: the transfrom call in formatToken Constructing inputString in wordOccurence...
I would like to get feedback on the solution and a question regarding Big O. I am first converting each character in the string into the array and that would be O(n) then i am sorting the array O(n log n) and then I join back the array. Not sure if that is O(n). After i get the sorted string I would retrieve the NSAr...
I made a simple state wrapper for a react project I am working on, so I can keep my state at the top component but reason about it at a lower class level. The example below is very simple, but it works and provides enough of an example of what StateWrapper does, obviously i am using it in reality with a much more compl...
I am a relatively new Python programmer and made a simple Pig Latin to English translator and vice versa. I would just like it if someone reviewed my code and see if anything can be done to make it more Pythonic or efficient. from time import sleep def main(): to_piglatin = input("Do you want to translate somethin...
It's been some time since I wrote something in C. I am looking for some advices related to my code in terms of coding style, bad/wrong logic, optimization (performance) and good practices. The code speaks for itself, but if there are any questions, I'll add some comments to make it clearer. #include <stdio.h> #include ...
I have to write a function which turns a string with the words separated by dashes ( - ) into a sentence using camel case notation. I've had the following idea for an implemenation using the reduce-method of Array: // -------- THE ACTUAL FUNCTION ------------------------- /** * Converts a string with dashes as wor...
The TESSER - Finding the Tesserect problem is tagged as a problem to be solved by Knuth-Morris-Pratt (KMP) algorithm. I'm using KMP, but am still getting time-limit-exceeded. Task Each of T test cases (1 ≤ T ≤ 105) consists of three lines: A single integer N (2 ≤ N ≤ 105) denoting the number of data points. N integers...
The main idea behind this class is to create a wrapper for commonly used Database classes. I'm new to SOLID principles and I'm trying to implement them in this library. Does this code adhere to SOLID principles? //This is the opens the SQL Connection and is placed in DbConnectionSetup.cs public interface IConnecti...
here is my code, it works but after few iterations it slows down and stop without any error, I'm looking for a more efficient solution. #include <iostream> #include <vector> #include <algorithm> #include "SafeQueue.h" using namespace std; const int DATA_MAG = 256; struct Frame { int num; char type;...
If I have an array of numbers like this: 1 3 4 6 7 1 2 2 4 5 9 5 7 1 2 3 5 Is there a quick way to take all of the unique numbers and arrange them into a single column, like this? 1 2 3 4 5 6 7 9 The approach I have works, but takes a very long time for large matrix: Sub Test1 Call RecordArrange Call Re...
I'm writing a program to read two files supplied as arguments in the command line, convert them from list to char[][], and display their contents to the user. I'm trying to practice exception-handling and javadocs, so I'm not interested in using a library. Also, this will be part of a larger program, hence the conversi...