instruction
stringlengths
71
95.1k
I'm trying to make it so that a string generates n keys, and all of those are required to recover the original string. For this, I generate n-1 random strings, XOR them all together with the original string to get the nth one. XORing these n strings reproduces the original strings How secure is this? Is there any bette...
Can you help me with suggestions regarding my code for Tic Tac Toe Game? This is my code, I've tested it and it works, but I feel like it can still be made shorter/clearer. I am not a good coder and it might look ugly to some. public class MainActivity extends Activity { /** * Called when the activity is firs...
Problem statement: Given an array of unknown size and containing only integers between 0 to 30 (inclusive), write an algorithm to find which numbers are duplicated, if any My solution in C#: public IEnumerable<int> Duplicates(int[] sequence) { var targets = new Dictionary<int, int>(); foreach (var n in sequen...
I came up with the following Brainfuck interpreter in Haskell after thinking about how to represent the program and the memory functionally using zippers to represent current location. This works since in Brainfuck, there is no way to reference more than one memory location away from your present location at one time. ...
This is some prototype code for a spin-lock for my toy operating system. Bear in mind this means there are no standard library routines to fall back on. It's also for C++11 compilation and will only ever be compiled by the GNU G++ compiler. The primary use for this is in the scheduler and other code that accesses the...
It's my first year in college studying Java so please excuse my ignorance in programming. This is my 5th Task in my Sequential Programming assignment, where we had to design a program for a packing company to place orders and print a receipt. Could you please give me any advice you may have on my code? package Lab; im...
It is my first year in college and I have designed a code using pretty much my own basic knowledge. I have designed a program to work out the price of items for wholesalers or retailers. Special customers also get a special discount if they are to click on the button. Please take a look at my code and give me any feedb...
I have the following class which returns an expression that then returns data. It seems a tad over complicated and I'm pretty sure LINQ has something to offer that makes my life much easier. But I simply cannot get it. /// <summary>Provides methods and properties to query location details from a database.</summary> int...
I am trying to implement a "Caeser cipher" to every lower case character in a string, by using a number to control the amount of character rotation. Here is an algorithm that I came up with. Can you please review and give me some feedback? #include <stdio.h> int main() { char string4[80]; int rotatorN; pr...
I'm learning about OOP and I'm attempting to solve the White Elephant Gift Exchange game. The way I've done it is that I have created a bunch of set variables which store the set of gifts opened, set of gifts not opened yet, set of users. I was wondering if this is a good way of designing the classes and delegating wor...
I'm new to Java and I've written a flashcard program in Java 8 that allows the user to create a collection of flashcards and then test themselves using those flashcards. Please provide any recommendations on the readability and the design of the program (including my use of OOP). Here's some specific areas that might b...
C#'s String.Split method comes from C# 2.0, and lazy operations weren't a feature back then. The task is to split a string according to a (single) separator. Doing so with String.Split is used like string[] split = myString.Split(new string[] { separator }); Now, not that bad, but if you want to add more operations to...
I'm just starting out using OOP; classes and methods etc. I've been looking around for some PDO classes/wrappers out there, but there's not much to choose from. So I've tried to make my own. Started out by writing an "insert" method. As a man with low self esteem, I never like what I do myself, so I thought I'd ask you...
I wrote a program that calculates the minimum number of rungs of a "word ladder" between a starting word and an ending word. The function minlinks() takes in 3 arguments: a list which acts as a dictionary, a starting word, and an ending word. It returns an int[] of two values; the first is minimum number of links in th...
I have multiple forms that send an email. As of this moment I have 3 forms that send mail and vary only by the number of inputs: One requires just an email Another requires a name and email Another requires name, email, and a comment Instead of making 3 separate functions to mail the inputs away, I figured I could co...
I'm trying to map a components type to the component value itself in a map. The following code all works properly. My main question is this. Is storing the map key as std::type_info* the best way to accomplish what I'm doing? I'm also not digging the ugly static_cast<T*> I'm doing during the usage part. Entity.h #pragm...
Can anyone help me optimize the current VBA code below? It is taking 20 seconds currently to collect,store, check and validate 1000 data's. This program takes specific values from multiple sheets and does addition as the values goes beyond one column or row so loop for addition. And uses 4 values to check for duplicate...
I need a method which will parse text to RichTextBlock-compatible XAML markup with clickable links. Example: Input: "Hello, check new service for students! Check edusty.ru and http://edusty.ru/test?text1=abc&args=123 sites. Check edusty.ru/privacy.html to read privacy policy." Output: <Paragraph xmlns="http://schemas...
Problem statement: Given an integer n, write a function to return an array of size n, containing each of the numbers from 0 to n-1 in a random order. The numbers may not repeat and each number must show up exactly once. Solution # 1: Generate an ordered array then shuffle it private static int[] Shuffle(int n) { va...
I recently asked a question on StackOverflow, looking for a way to more easily turn a class attribute into a @property, but only if no other value has been provided to the class constructor. A simple way to do this is class Demo(object): def __init__(self, value=None): self._value = value @property ...
As far as readability and best practises go I am not sure how best to write this helper method: Here are two options I have tried: private decimal? selectTolerance(decimal? globalTolerance, decimal? localTolerance) { if(localTolerance == null) { if(globalTolerance == null){ r...
This code implements an algorithm for calculation of chemical schemes. This code looks strange but now I have no idea how to refactor it. Can you give your feedback? eps=0.001; s1=new Source(1000,0.17); mx=new Mixer(1000); mb=new Mem(0.15,0.95); sp=new Splitter(0.80); s2=new Sink(); s3=new Sink(); mx.in1=s1.out1; mx...
My daughter, nine, recently had some homework looking at number palindromes. Part of the assignment was to take a number, reverse it, add the two together and repeat until she got a palindrome and to do this for several different numbers. While helping her with this it struck me it'd be a nice simple idea for a compute...
Can I use this function to reliably attach a list of excel files to an email and create a secure connection to transmit said email? My python programming is self taught and I put this function together with a lot of google searches. (This function works, I use it, but I would like to have someone with more experience l...
I have a server that is pretty stable (disk capacity) until a certain event occurs and then the drive grows over the course of two days until it is full. I wrote a very simple bash script but I'm not too happy with parts of it. First, I want to be able to see the capacity as a percent down to the tenths place. Also, do...
This class is part of a utility that reads lines from a set of nonblocking file descriptors, blocking only when there are no complete lines to emit. class NonblockingLineBuffer: def __init__(self, fd, encoding): self.fd = fd self.enc = encoding self.buf = bytearray() def absorb(self): ...
I'm trying to optimize a nested for loops that compares an element in the array with the rest of the element in the array. There's two part, the first part is for example, an Array has 3 elements, and each element is a dictionary: [{"someKey_1":"a"}, {"someKey_1":"b"}, {"somekey_1":"a"}] 1st iteration(1st element co...
I just read this article on how to write a standard-like algorithm and wanted to try it myself by writing (as suggested in the article) an algorithm to test if a sequence given by two bidirectional iterators is a palindrome. Here is my code with two different ways of calling the algorithm (is_palindrome and alt_is_pali...
I would like to select some information I have stored in my MySQL DB. I have 2 tables named gameTable and playerTable. Now I want to get the gameTable and get the names and levels of these players. This is what I got so far, it works but I'm not sure this is the most efficient way. Do I really need to create a join f...
I have an application which log file has most lines start with a time/date, followed by a debugging level and the actual log message. Often I want to watch the output live and colors make it a lot better readable. This is what I use at the moment for piping the logs: while read line; do echo "$line" | sed -e "s,^.* DEB...
This is a tags counter that I implemented to a site. The script is supposed to display the number of tags that a user can still input - the limit has been set to 5 items (tagsLeftTmp = 5). The input field $(".bootstrap-tagsinput") has two events attached to it - one event substracts 1 from tagsLeftTmp, the other adds 1...
I've implemented a class to perform a couple of tasks through a web service. I'll be really keen if you can take a look at, give me your professional opinion. using MWM.NavisionWebService.WebReferenceTest; using NLog; using System; using System.Net; using System.Configuration; namespace MWM.NavisionWebService { pu...
I have been in conversation with a fellow web developer on whose servers I am doing some client work. Part of the current project is to add an email sending system from a web based form to my clients email via PHPMailer. I have used PHPMailer repeatedly with no issues whatsoever, however, this developer has said to me ...
This code is the whole logic for the AngularJS ui-select lib. I'm not (yet) a JS pro and still learning AngularJS as well but I'm pretty sure this can be done a little more efficient? I'm talking especially about the search: part of the object. In php I would probably do something like array_diff. Any critiques are wel...
The level 3 menu is broken in 2 parts if there are more than 10 items. The issue is with hovering over the newly created list. At this moment I have 3 functions that apply the shown-sub class. I want to reduce it to only one. It should work when hovering over cotton and both ul lists. !function(){ $("#nav ul.level0...
Is there a better way to structure a method that returns a task that queues several inbound socket connections? public Task Start(CancellationToken token) { return Task.Run( () => { var acceptCount = new SemaphoreSlim(10); while (!token.IsCancellat...
About a year ago, I was given a C++ assignment as a preliminary job-interview test. The assignment included 4 different tasks, from which I had to choose one. I actually chose and completed 3 out of 4 tasks, but I did not pass the test. I was not given any specific rejections, so I would like to get an unbiased opinion...
About a year ago, I was given a C++ assignment as a preliminary job-interview test. The assignment included 4 different tasks, from which I had to choose one. I actually chose and completed 3 out of 4 tasks, but I did not pass the test. I was not given any specific rejections, so I would like to get an unbiased opinion...
About a year ago, I was given a C++ assignment as a preliminary job-interview test. The assignment included 4 different tasks, from which I had to choose one. I actually chose and completed 3 out of 4 tasks, but I did not pass the test. I was not given any specific rejections, so I would to like get an unbiased opinion...
I’ve been getting used to Java and I’ve written a simple hangman game using event-driven programming in Java 8. Please let me know of any improvements regarding the readability and design of the program, along with any pointers on how to neaten up the code. Also, any feedback regarding the use of JavaDoc style comments...
I've implemented a teleport feature for my game and I would like some feedback on the way that I validate the user input. I am using the libGDX library. When the player clicks the Teleport Menu button, a menu will pop up that has two TextFields pre-populated with zeros. The user can click the TextField to begin input,...
I just learned about the beauties and wonders of interfaces and I realized how I could fix some code that has been bothering me because of its duplication. This is my ISettingsProvider, SettingChangedEventArgs class, and ApplicationSettingProvider class, which are in the same file: public class SettingChangedEventArgs ...
I have a Class with a List of objects, and those objects contain a list which has lists to objects in the first class, and I'm trying to quickly index them. Simplified: class Person { public IEnumberable<HistoricalEvent> Events { get { return World.HistoricalEvents.Values.Where(x=>x...
I'm trying to get more familiar with Java 8 streams as they seem to be very powerful (and shorter), so I rewrote a method to use streams. However I'm not very satisfied with it and would like some suggestions on how to make better use of streams. The code itself has multiple nested loops, so it's not very easy. Also I'...
I have found this appearing-to-be famous problem in Stanford tutorial about trees and decided to solve it. My solution appears to work great: #include <iostream> using namespace std; struct num { int n; num* left; num* right; num* next; num* pre; }; num* cr (i...
I am trying to write a ruby script that will take all of the CSVs in a given directory and map their headers out so that duplicate columns will match up and columns unique to a file will have their own column in the final data file. The following code produces the output I desire, however something about it seems overl...
I have a data file that looks like this: Friend Name Joe Likes Jill Age 30 Gender Male Friend Name Likes Mark Age 30 Gender ...
I am trying to come up with a simple basic calculator but am supposed to work with the following constructors and methods: simpleCalc(); simpleCalc(double op1, double op2); double add(); double add(double op1, double op2); double mult(); double mult(double op1, double op2); double exp(); double exp(double op1, double o...
This is a follow-up to Extracting lines from a bytearray ; I got a pretty good answer to the narrow question I asked there, but was invited to show more of the code in case there was a simpler way to solve the larger problem. So here's my entire module. Note that the use of PollSelector instead of DefaultSelector is ...
This program (C++) was for a class project. A program that recognizes a given context-free language by implementing a pushdown-automaton (PDA). The PDA recognizes the following language: S → $T$ T → T+T | T-T | T*T | T/T | (T) | CX X → XX | C | N | _ | e C → a | b | c | · · · | z N → 0 | 1 | 2 | · · · | 9 The...
I've read so much arguing about "sort by value maps". Well, I wrote the following log(n) sort by value Map . And, by the way, a real Map , does not allow duplicate keys. Many of the maps I googled ignore that annoying problem. I assume this map is still log(n)...: public static void sortByValue_logN() { class MyCo...
In my Android app I have a Service that is periodically polling a server for a music playlist XML. For certain occasions I also want to trigger a reload manually. I am using Retrofit for the server communication and my Service exposes an Observable<Playlist> to which some other components of the app can subscribe. At t...
Is there too much logic in this controller (should I migrate them to the model)? How else can it be refactored? class StatsController < ActionController::Base def create @stats = Stat.receive_stats(STATS_SOURCE) sport_type = @stats["sportsID"] Stat.categories.each do |category| ...
I've recently implemented a Wilson's Algorithm for maze generation. This problem however could also be extended to things such as snake, or some other simple AIs. The problem is as follows: Blue Node -> Previous nodes Red Node -> Current node Black Line -> Wall In this case, we can analyze each of the 4 possible dire...
Given a set of numbers insert them so that they are ordered ie. add(5) add(3) add(6) add(2) Output: 6 5 3 2 GetNumber() returns the number of that term insertAfter() inserts that node after the pointer insertAtHead() inserts as the head node Term is the Node which holds the number How can I refactor this working c...
Had to create this for my class, figured I'd get some advice/insight on how I can advance my program while making it more efficient. Also want to help anyone who may come across the same assignment and is in need of direction; with this said, I would have regretted copying anyone work because I learned a lot about C sy...
Here is a simple Hopfield network that I wrote with the help of a book that I am reading. I would like you to review it and give me your suggestions, especially for the node-updating part (the last part of the main function). Example: The network should remember these patterns: 1111, 1010, 0101, 1001, 0110. If you ente...
I've been working with the SerialPort class for a while, trying to figure out the best way to work with it, and especially adding support for Async-Await in C#. I also started before 4.5, so I didn't have access to the BaseStream member (so no BaseStream.ReadAsync()). I wanted to get some opinions on it before I starte...
I'm trying to do a Bilinear interpolation on the ARM Neon. However, I find that my vectorized code is slower than the regular one, on a BeagleBone Black. Any idea why this could happen? I'm using gprof to debug and compiling with the following flags: NonNeonFlags: g -Wall -pg -O3 -ffast-math NeonFlags: $(NonNeonFlags) ...
I have an Android app that uses randomly generated tokens to log in. They're 5 characters long, are sent to a user's email address, and have a short lifespan, so I don't think I need anything that's extremely secure. I'm getting odd result that suggest I'm not really generating random numbers. That, or I'm seeing pat...
I was bored yesterday morning, so I wrote a brainfuck interpreter. I know there are a lot, but this one is different. Why? Because it evaluates brainfuck code on the fly, reading from the input file, and eliminates code once it's not reachable anymore, instead of reading the whole program, analyzing it, and evaluating ...
I have two Collections and want to compare them. var valueFirst = new ValueFirst(); valueFirst.Id = 1; valueFirst.Amount = 12; ... var valueSecond = new ValueSecond(); valueSecond.Id = 123; valueSecond.Amount = 12; var firstCollection = new FirstCollection<ValueFirst>(); firstCollection.Add(valueFirst); var second...
The following procedures are an attempt to connect some physical aspects of the sound (frequency and duration) to traditional music theory. Each procedure is accompanied by one or more examples. The names of the procedures are in Italian, but thanks to the examples should be understandable to those who have a basic kno...
I did this code for an interview. Can you tell me how it looks? I didn't get the job, so I'm wondering what I could do better in my code. /** * TASK 1: IMPLEMENT: C - binomial coefficient * * C(n,k) = n! / [ k! (n - k)! ] * Where x! is the factorial of x * * Use a recursive solution. If needed, you can impleme...
I'm implementing a number of classes in C# that have async methods. However, each of these methods needs to implement some boilerplate code that is common to all. Therefore I've implemented the common code in an async method of a base class; the async methods on the derived classes then call this base class method. Her...
I'm sketching a simple thread-safe cache which can load missing values. It is based on RxJava's Observable which also means that it should be possible for a client to join a request for value which is already in flight. My major concern is how to make it thread-safe whilst keeping an eye at performance and possible de...
I have a method which creates some default values in an ObservableCollection, nothing too fancy, but I'm trying to decide how to write the if statement. private void CreateDefaultParameters() { //If there are no parameters, then create default ones. if (this.Parameters == null || this.Parameters.Cou...
This sequence properly shows whether the TouchpadOff option for synclient is on or not (outputs either a 0 or a 1): synclient | grep 'TouchpadOff' | tail -n 1 | awk '{print substr($3, 1)}' Trying to make a keyboard shortcut to toggle the touchpad with a basic script based on that line, I wrote this: #!/bin/bash PADOF...
I have a has_many through relationship between my cities and travels that looks like this: class Travel < ActiveRecord::Base has_many :cities, through: :destinations end class City < ActiveRecord::Base has_many :travels, through: :destinations end And on my Travel controller I have a method to join all its cities ...
What are my options on how the loginToNetflix method is called? Is there a more clean and elegant way of accomplishing this? loginToNetflix(credentials.username, credentials.password); function loginToNetflix (username, password) { casper.start('https://www.netflix.com/Login?locale=en-US', function() { this.echo('...
I have tried to obtain speed gains by transferring Matlab calculations to C and call it using .mex. My goal is to operate on a matrix \$B\$ which has roughly the dimension 10000x1000 $$ \frac{1}{\text{size(B,1)}}\sum_{i=1}^{2+l*t} \text{mean}( (B(:,i)-B(:,i+1))^2)$$ for \$ l*t<\text{size(B,2) and chosen } t \in \mathb...
I have written a Rational struct for working with rational numbers, i.e. Rational(int numerator, int denominator). A recent post regarding rational numbers peaked my interest. I particular like the answer by @aush with his RationalNumber class. I am inclined to think of a rational number as just that: a number, akin ...
Would like to know if the factory pattern I've implemented for my stat library is the correct way to go. I have an interface IPlayerStatsManager where the type parameter is an interface as well (IPlayerStatsModel). The IPlayerStatsManager is an interface that lists the common operations that can be performed on any cla...
I'm trying to build a ThreadPoolExecutor singleton to use it across my app. I'm very new to this concept and after going through Google docs I have created this: public class MyThreadPoolExecutor { // Sets the amount of time an idle thread will wait for a task before terminating private static final int KEEP_A...
I have the following input: newValue = [['men', 'John Doe,Chris perry'], ['women', 'Mary,Anne,Lita']] - list within list keywords_list = [('MEN', 'john,zack')] - tuple in a list (Dictionary on which .items() is used.) Expected Output is: newValue = [['men', 'John Doe'],['women','']] What I want to do here is extract...
I am facing performance issues while reading a large text file from the network. The same file is read locally without any performance problems: int file_no_lines(char *file_path) { FILE *fp = NULL; char line_read[200]; int linecount = 0; fp = fopen(file_path, "r"); while(1) { if (fgets(li...
I've implemented a quadtree in C++. Ignore any apparent similarity to the pseudocode on Wikipedia, it's all in your head, I swear. How can I improve it? Algorithm speed/space improvements, any extra functions that I'm likely to want... as well as general practice. #ifndef _QUADTREE_H_ #define _QUADTREE_H_ #include <ve...
For a recent lab at the university we had to match the longest prefix for an IP (v4) address by using a Trie data structure. The code works fine, but it takes about 2 minutes to load a 14 million-line routing table. I examined what was causing the slowness, and it was the (String) IP to (String) binary format conversio...
Most of the C code I have written has never been seen by anybody else, and I wonder if my code follows normal practices, especially how my code performs security-wise. The code is for a library that I have made for working with strings, and it is for use in other programs. The full project can be found on GitHub. The f...
I now use a grid system similar to that of the one created by André Luís located here: http://andr3.net/blog/post/142 and evolved by Lea Verou located here: http://lea.verou.me/2011/01/styling-children-based-on-their-number-with-css3/ Made my first grid system supported back to IE8 if respond.js is used (or another met...
I am trying to move some logic outside my controller for creating my view models for the view. I have a lot of queries to fire to make sure the complete view model is ready, so to keep my controllers thin I came up with this design - any feedback, comments or suggestions are welcome! The interfaces looks as following...
I had a look on Stack Overflow etc. on how to perform a contains ignore case with n given strings. Most answers suggested using regex for this task. Although it's a valid option, I prefer doing upper-case for both strings and apply a .contains afterwards. The solution I came up with looks like this: (defn desc-matche...
Context: I am working on the login module of a PHP web-application and I am trying to implement this using PHP/PDO and the DAO pattern. I would like someone to review the code below and let me know whether my understanding is correct or not,i.e, am I implementing it correctly. The application would require the user to ...
Generic Headers #include <vector> #include <string> #include <iostream> #include <fstream> typedef std::string const BFProgram; BF Interpreter class BFInterpretor { static const std::size_t MemorySize = 10000; std::vector<char> memory; std::vector<std::size_t> openLoops; BFProg...
In the last few day, I wanted to sharpen my C skills a bit, so I wrote a math expression interpreter that can handle + - * / ( ) and only integers. I just want to know how good this code is, if anyone has any comments on any part of the code and if writing such code guarantees that I understand every aspect of the C la...
Is the following functions implemented correctly for the set class? Please let me know if any changes need to be made. # Implementation of the Set ADT using a Python list. class Set : # Creates an empty set instance. def __init__( self, *initElements ): self._theElements = list() for i in ra...
I am implementing a function which searches through a ring queue for a given substring. The function returns true if the substring is found, otherwise false. There is a cell containing null between the tail and head to signify the end of string. Please give feedback on this implementation. bool SoftwareSerial::contains...
I had a homework assignment to create a simple hex editor that reads binary files as well as write integers to it. However I enhanced it a bit. Homework is already submitted, but that doesn't mean this code will remain without a review. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> #inc...
Can someone help me furnish my PHP validation class? I want to reduce its size and make it easier to use. <?php class validate { function check_empty($name,$value) { if(!empty($value)) { $msg=""; return array($name=>$value,$error=>0,$err_message=>$msg); } else ...
This used to be university work now I put it our here for review purposes. Could this be constructed better? Is there any easier path, performance-wise? Could this be optimised? Which features and functionalities could/should be added to this game? <!doctype html> <html> <head> <title>Math.floor</titl...
I'm trying to generate prediction bands for an exponential fit to some 2-dimensional data (available here). The data (blue points), best fit found by scipy.optimize.curve_fit (red curve), and lower & upper 95% prediction bands (green curves) can be seen in the image below. I'd love some confirmation that the code is a...
I have to write a python function that takes a string that contains raw unicode strings (e.g. "u'hello' there") and transform it into a string that strips the u'' identifiers from it. For example: strip_inline_unicode("u'hello' there") # -> 'hello there' Without getting into too much detail as to why I have to do thi...
I'm trying to optimize a nested for loops that compares an element in the array with the rest of the element in the array. There's two part, the first part is for example, an Array has 3 elements, and each element is a dictionary: [{"someKey_1":"a"}, {"someKey_1":"b"}, {"somekey_1":"a"}] 1st iteration(1st element co...
Just another step in my educational Trek. I didn't know when/why I would use the transparent feature and in experimenting with it, I made this. This one was fun to behold once done. It's an animated flying gif and you can move it around the screen and press keys to alter its speed or add effects to the image itself. im...
I implemented most of the suggestions from Version 1. Thanks to all who took time to review and offer really good comments. namespace NotSystemAndOthersThingsThatIHaveNoPracticalUseFor { // This is Version 2. public struct Rational : IComparable, IComparable<Rational>, IEquatable<Rational> { // Ret...
I am trying to generate a simple map like this. Everything works as I want, but I am new to programing. Is it a good way to do something like this? And if not, could someone explain to me where and why it is bad to do something like this? And how bad is it on performance? public GameObject cube; public GameObject cube1...
Project Euler 12 - Highly divisible triangular number The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be \$1 + 2 + 3 + 4 + 5 + 6 + 7 = 28\$. The first ten terms would be: \$1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\$ (...) 28 is the first triangle number to ...
After an interview didn't go smoothly, I decided to write my own library so that I would be better prepared if I'm ever asked about matrix multiplication again. I know that doing it in Java is going to sacrifice some performance (at least I think I do). Also, I know that there are libraries already made for this purpos...
At a JavaScript test for a job, I was asked the question below. I believe there has to be a better way to accomplish the same result, but I couldn't find any. If some JavaScript geek would take a look and suggest a better approach I would really appreciate it: Given a positive integer greater or equal to 1, write a fu...
This code is working fine for me, but I want to simplify it. Function parents is defining parents of the tree and children function is for representing children. DisplayGraph() function shows the tree in an HTML element. window.onload = function() { arr(); parents(); }; var array =...