instruction
stringlengths
71
95.1k
I'm just getting started with Python and was hoping for some feedback on a simple Tic-Tac-Toe game I wrote. Specifically, is there a simpler way to check the win conditions for the game, and to break the loops at the end without repeating the code twice, and just generally how to shorten this to achieve a similar effec...
I had a JSON file in this format: { "cols": [ "Employee", "start_time" ], "data": [ [ "Serena", "Sat, 22 Aug 2015 14:06:03 -0700" ], [ "Rhonda", "Sun, 25 Mar 2012 10:48:52 -0700" ], [ "Fleur",...
I am a total beginner at Python, so I wrote a very simple snake game using pygame to get some practice with it. I also don't have too much experience with object-oriented design. Does the code layout look okay? Is it easy to read and understand? I'm sure it can be simplified some. The update_segments section in pa...
I am no JavaScript expert, and I have managed to hack together a node.js script that does exactly what I want it to do: upload images contained within a folder to Google Cloud Storage for a Firebase project, and then return the public access URLs. Given that I have limited experience with node.js combined with GC Stora...
The problem I am looking to solve is wrapping a web scraper in a RESTful API such that it can be called programmatically from another application, frontend or microservice. The overall goal is that this piece of code will form one part of a larger application in a microservices architecture. This program scrapes the Ra...
The algorithm bellow is meant to allow a user to roll a die as many times as he would like, then print how many times each side was rolled and how many rolls there were total. import java.util.Random; import java.util.Scanner; public class DieRoll { public static void main(String[] args) { // TODO Au...
I just finished my first full app in JavaScript and I'm hoping to get some feedback. I guess I'm looking for overall design advice, use of classes and functions etc. but anything is fair game so I am keen to hear any constructive criticism. /**************GAME OPTIONS*******************/ const options = { //Game ...
This is a homework assignment. Convert an integer (1 - 2999) to roman numerals. I was wondering if I could make my code more efficient. The way I have it set up is that I take the digits of the input (the thousands, hundreds, tens, ones) and have cases for each of them. However, the approach I took to this problem is t...
I'm within an audio application that sends variable-length buffers to my DLL, which will process at higher speed (48000 samples per sec, but can also be higher). Here's the code I've written: while (remainingSamples > 0) { int blockSize = remainingSamples; if (blockSize > PLUG_MAX_PROCESS_BLOCK) { // PL...
I decided to go with a very simple CGI user registration program to pair with Apache's mod_auth_form wrapper around a private site. It was only just after I finished writing that I realized I'd written security-sensitive code in a language I'm not my best at. Is this code secure from parameter injection attacks? I.e., ...
Lately, I've been developing sorting algorithms as a kind of exercise to make better code and I've come accross something curious, even though bubble and cocktail sort are known to perform horribly, I think I might be doing something wrong since it takes a larger amount of time than selection, insertion and merge sort ...
I'm new to the world of python, and wrote this quick sort implementation which was taught to us in an algorithms class. I would like to learn to write code less like C++ and more pythonic. Could you review my code to make it more pythonic and less buggy? (I'm sure a class implementation is better, but if the scope of t...
I've been working on this solution for a couple days now. Finally managed to get it to work and I got it to where it solves about half of the time. The other half goes for so long that it eventually just runs out of memory. The weird thing is that the solves are pretty fast. Before I updated the heuristic with linear c...
I'm going through the K&R book (2nd edition, ANSI C ver.) and want to get the most from it. How does the following solution look to you? Note that, for the sake of exercise, I don't want to use techniques not introduced yet in the book. Also, I'm trying to reuse whatever code/philosophy already presented in the book. /...
From original very simplistic code: Shell POSIX OpenSSL file decryption script I learned a lot both from the first follow-up review, and the second one as well, many thanks! I just need one final review round, so that I can feel confident, there are no more blind spots. I promise it is the last from this project, I do...
I'm trying to learn writing python programs in a modular way as much as possible. One of the issues I've had difficulty to solve is parsing command line arguments (with argparse) and having a logger object in all my modules which it's name will be the __name__ of the module and it's log level identical across all modul...
In my program, I have a tree of Group nodes, each identified by their ImportId. Each group has zero or more members, that I want to collect. Each group has zero or more child groups, referenced by their importId, whose members should be added to the collection. Each group has zero or more RuleParts. Each rulePart is a ...
I have been working on my script which allows people to sign-up and login to my website. I was wondering if someone could review the code. It works but I can't help but feel it could be optimized. forgot_password.php <?php // core configuration require_once "config/core.php"; // include login checker require_once "log...
On interview I was asked to write method with following contract: boolean checkList(List<Long> list, long sum){...} for example it has to return true for arguments: ({1,2,3,4,5,6}, 9) because 4+5 = 9 and it have to return false for arguments: ({0,10,30}, 11) because there are no combination of 2 elements with sum...
In order to learn C++ I decided to code a Chip8 emulator following a tutorial. When I came across the idea of a flag register and decided it would be fun to implement in order to get familiar with bitwise operations. I'd like this review to center on what can be improved from the point of view of C++, but of course any...
As an academic exercise, I decided to implement a continuous shuffler, as seen on casino blackjack tables. It operates by storing a "linked loop" (a linked list with the last element linked to the first) and walking a random number of steps around the loop when an item is removed. public abstract class BaseShuffler<T>...
This is my attempt at implementing a Binary heap. I made an abstract base class Heap with an abstract property controlling whether it is a min-heap or a max-heap. One thing I've been struggling with was which collections.generic interfaces to apply to the class. Enumerating the heap only makes a bit of sense. At the s...
I was bored, so I decided to write a very basic HTTP Request/Response parser in C++. Some Notes: This isn't meant to be a complete implementation of the HTTP protocol This isn't meant to be the fastest/smallest/best library out there for this kind of thing. It's a lot of code, I don't expect anyone to read all of it, ...
I made this Python code that prints a sample string and ensures that the input of the user agrees with the sample, and then do an action with this inputted string, in this case a multiplication table. I've made this code to practice some Python concepts, and I do not know if I did everything correctly and "in a pythoni...
I'm creating a window class in C++ to provide a bit of abstraction for a GLFW window. window.h #pragma once #define GLFW_INCLUDE_VULKAN #include <GLFW/glfw3.h> class Window { GLFWwindow* m_Window; GLFWmonitor* m_Monitor; const char* m_Title; GLFWimage m_Icon[1]; int m_Width, m_Height; int m_P...
I am relatively new to C# and would like to see if what I have been using for my exception handling, message and logging is along industry standards. I have created a simple class for the Error Handler and for the logging I use Log4Net. After reading Clean Code, I was thinking about separating DisplayMessage into 2 dif...
I wrote a code like below - It is nuxt.js, which is one of the Vue frameworks. This code will be expected to When change event triggered, update data value. There would be some logic to alter passed data At the same time, it connected with data value to apply input box changing <template> <div> <!-- I got que...
I started out creating a simple game in an Object Oriented way to practice. The rules are pretty simple There are two players You let one player choose if they want Heads or Tails. You assign the leftover option to the other player. You simulate a coin flip and say who won that game. More than the logic, naming con...
Working doubly linked list using C++ and templates, I tried to make it by myself. I tried to use head and tail as buffers and make a simple implementation. Please help me understand what I have done wrong, done good and could have done worse. #pragma once #include <iostream> template <typename T> struct node { T v...
I'm attempting the Graph Algorithms section in CLRS right now. Here's an iterative DFS using a stack called nodes. T is a vector of pair(s) of ints which store timestamps for each node. T[node].first = discovery time T[node].second = finishing time P is a vector recording Parents for each node in the DFS-Tree. N is num...
I have a dictionary structured as {a_1: [((b_11,c_11),d_11), ((b_12, c_12), d_12), ...], a_2: [...], ...}. I want to extract the maximum abs(c) among all the possible c values. Currently I'm doing this throught two for loops. One for each a, and other for each of set {b,c,d}. elements = { 0: [((0, -4), 1)...
I have two types that don't share any interface but have similar properties and that I need to compare for equality. One of them is comming from a 3rd party library and one of them is mine. I obviously cannot add any interface to the foreign type and honestly I don't want to create any wrapper for both of them in order...
I have a report with a group by filter. A stored procedure returns all the data and maps it to IEnumerable<EventListRow>. The code should then group the data as per the user group by selection. In the following code, only the GroupID and GroupName changes each time. Is there a better way to write the code that avoids d...
I recently rewrote my object pool design to \$O(n)\$ complexity. I did this using a linked list, which is not native in JavaScript. It does not, unfortunately, automatically assign null to a value when you free it. const Pool = function() { const Free = new WeakMap, Next = new WeakMap, Default = new W...
This code is a digital periodic table that I am working on, but it is taking forever as it is very long and I would like to shorten it. #This is the intro sentence that explains the way my element index works. print("Welcome to my element index! You must enter the name of an element with a capital letter. Also you are ...
This code is looping over polygons geometries vertices in order to create a list of deltas (distance) between vertices coordinates to compact the geometry before sending it into the web. Geometry output is expected to be on this format: [[x0, y0, (x0-x1), (y0-y1), (x1-x2), (y1-y2)]] The output is a JSON object contain...
Here is a simple text-based version of connect four I made. I have been building this in an attempt to improve my Java skills (and possibly mention on my resume). My goals with this project are as follows: Clean, optimize, and restructure: code, classes, and game logic based on feedback. Transform this program from te...
I am trying to create a directory, but I have to check whether /usr is present initially, later /usr/local is present and so on, is this an elegant way of writing it? #include <stdio.h> #include <string.h> int main () { char str[] ="/usr/local/mnt/"; char path[40] = {0}; char temp[40] = {0}; char *slash = "/";...
I started learning Rust a few hours ago with the Rust Book (2018 edition) and as part of one of the exercises decided to make a temperature converter. I wanted to make sure it handled all inputs properly in an idiomatic fashion. The code is as follows: use std::io; use std::io::Write; use std::str::FromStr; fn main() ...
Please review my Breadth-first search algorithm implementation in Java for finding the shortest path on a 2D grid map with obstacles. The findPath() method receives a map array of integers where 0 is an empty cell, and 1 is an obstacle, the function returns a list of coordinates which is the optimal path or null if suc...
I am going through Elements of Programming Interview by Aziz, Lee and Prakash one of the questions is how to determine if a string can be permuted to a palindrome. For example edified can be permuted to deified and now its a palindrome. So my first implementation is this: bool CanFormPalindrome(const string& s) { s...
I am new to programming and started learning with Automate the Boring Stuff with Python. I just completed chapter 3's "Collatz sequence" project. I was wondering what would you do differently and why? Trying to learn how to think like a programmer and become more efficient. def collatz(number): global nextNumber ...
I've created a very plain version of page flip onscroll. I made it to look like turning the pages of a book. It looks OK on browsers I have (Firefox 52.9, Chrome 49, IE8). Though the effect doesn't work on IE8 and similar old browsers, it still doesn't look messy. I want to use this presentation method on a website. A...
What I want my code to do is that if we're on day 3 then we want to increase the week by 1. But if week number is 3 we want to reset the week to 1. The code below works but can it be simplified? Java code public int calculateNextWeek(int week, int day) { if (day == 3) { if (week == 3) { return 1...
The rules of the game are pretty simple. I'll put it here in case people don't know them It's a two player game hand game where they alternate being a batsman and a bowler. Who decides to do what initially is determined by a toss. These are the hand gestures which has a corresponding score Both the batsman and t...
This is my first Go project. Coming from a Java developer background, this code just smells very bad. But, cannot figure out better way to do this. It's a small app to find suggested flight destinations based on one or more origins (by their airport-codes, called codesbelow). Basically finding flights that have the sa...
This Java code project was submitted for a job opportunity but was marked down for showing "bad habits that could be difficult to unlearn" but I am mystified by what this means. Any takers please. How could it be approached differently or improved. I have removed any reference to the company involved, but the challenge...
I have made a simple To-Do Application just to get started with HTML/CSS/JavaScript and here is what I came up with. I have done what I can do at my best but still, I need some suggestions on my code, because I am new to Web-Development. Well, here is what my code is doing: This application helps others remember the wo...
I've written code that performs a merge of two streams of sorted time series data. The first stream is taken to be the primary and any successive streams are merged into it, using the nearest timestamp match to align data. It can be assumed that there will only ever be one match per primary timestamp. const primary = [...
I've written a function to update the contents of an HTML element to display a counter. On pageload the counter will recieve an initial value, every five minutes the new value will be requested from the server. Over the next five minutes, the initial value will loop to the new value. const increment = function(counter,...
I needed to stitch together a large number of badly formatted log files. I [painfully] developed a script for it in R, one that successfully dealt with the various flaws in the dataset. However, this script is rather slow. Considering I'm a neophyte to the field (and don't know what I do not know), I was hoping I could...
When processing large files (say for parsing or performing computations based on the contents), we want to be able to use multiple processes to perform the job faster. In my case I wanted to count the frequency of appearance of features in a LibSVM formated file, similar to a word-count which is a typical parallel proc...
I'm going through the K&R book (2nd edition, ANSI C ver.) and want to get the most from it. How does the following solution look to you? Note that, for the sake of exercise, I don't want to use techniques not introduced yet in the book. Also, I'm trying to reuse whatever code/philosophy already presented in the book. R...
In order to avoid having to make any real progress (at least for a short time), I wrote a script that measures how much progress I have made so far, instead. Specifically, this script sums up the file sizes of files in all commits of a git repository, filtering files either by their endings, a whitelist or not at all, ...
This is a C# console application that displays the n terms of even natural numbers between (1 and 100) and their sum Is this good? Or is it bug riddled ? int numberOfEvenNumbers; int currentNumber; currentNumber = 0; int counter; counter = 1; int sum; sum = 0; Console.Write("How many even numbers :"); numberOfEvenNum...
What I want to do is build a Slay-the-Spire-like Map. As you can see in the following image, the map is splitted in ISteps and IRooms. Each IStep is connected to the next one by its IRooms. There is no dead-end, so each IRooms is connected with the previous and next ISteps. Firstly, I have these two C# interfaces: pub...
I'm a beginner at coding who recently started learning Python, and I think I have grasped the basics. Now I'm working on my first "proper" project in Python. The problem is to have the program: Generate a standard Poker deck of 52 cards (no Jokers) Shuffle said deck Deal five (5) cards to three (3) hands/"players" (ca...
I am wondering if someone can do a code re"vue" specifically for my star rating component ([complete code available on github). I am looking for feedback on best practices, any glaring code crimes I might have committed and bad code. The code is also deployed to #Heroku here Problems I saw with the code previous code a...
I created a basic program that allows a user to continuously input values until he or she is satisfied; furthering, the program outputs the mean, median, and range. Then, the code gives you the option to run it again or exit. #Mean, median, and range from clear import * def main(): clear() list_one = [] whi...
Here is my second version of a bash program I'm writing, as per @hjpotter92 I've updated and cleaned it since last: This script is run directly after a fresh install of Debian, to do: sets up LS_COLORS====> colors in /bin/ls output sets up Portsentry (security for ssh and defence for ports) sets up syntax highlighting...
We've just finished learning about queues in my data structures class; I want to make sure I really understand it. I'm still feeling a bit lost on how to optimize the data use of a queue. I've created a little program here: #include <iostream> class Queue{ public: Queue(int size = 10){ ptr = new int[size]...
Simple variadic function implementation in NASM Assembly. When implemented like I have below: sum.asm ;; bits 64 default rel extern printf section .text global main global sum main: sub rsp, 40 mov r9d, 3 mov r8d, 2 mov edx, 1 mov ecx, 3 call sum lea rcx,...
I am fetching the friend list for a chat application using a Vuex store. I need to dispatch the getter via an interval. Is there a best practices way to do this? <template> <aside class="friend-list"> <h5 class="whos-online">Who's Online</h5> <ul class="users"> <UserListItem v-for="user ...
Disclaimer for future readers: We experimented around with a similar approach at HASH. The linked Pull Request is working. I wrote a small vector with a few lines of unsafe Rust. The idea is to have a vector, which can be read from simultaneously, but it needs the ability to grow. To realize that, the storage is organ...
I am learning algorithms and have implemented the Rabin-Karp string search algorithm. I didn't implement a rolling HashCode, but it's judged correct by this online judge. It's slower than the str.indexOf() implementation (7ms, compared to 4 ms). Can this be improved? What is the time complexity for this? class Soluti...
I've come across a simple challenge: given a phrase, check if we can form the given word vertically by stacking words in rows. For example, we can form the word "boom" from this phrase:    every breath             you take every move       you make My Python code: def can_spell(s, w): words = s.split() words_it...
I am trying to find the best way(/most efficent way) to setup my console program's menu. The way I have it set up is that I have a Menu class and then I use a menu pointer called currentMenu and I just change where it is pointing to. it runs fairly well so far but I'd like to know what I could do to improve it So Far i...
Here is my code for a class that is responsible for managing some common users task like registration, login and logout. It implements also a sub class that can be used to check the session of a logged in user. I've tested it and works fine, but I will improve it as soon as I can. Any suggestion on security improvement...
Something I've found myself having to do reasonably often is map properties from an Object (usually a heavily nested MongoDB document) to a different 'shape' to then pass it to a function call or API endpoint etc. Combine this with a development environment in which these 'shapes' are prone to change and it felt messy ...
I've taken on the challenge of modeling a simple User Voice-like system. High-level description: It's a portal for some SaaS users; They come and leave feature requests, suggestions, etc.; They should be able to vote/unvote for any suggestions; They can leave as many comments as they like on suggestions; Comments may ...
I'm writing an Azure function using Visual Studio (multi-layers project), where I'm managing all Azure ServiceBus related code in one class. (follow-up) public class MessageBroker : IMessageBroker, IDisposable { private readonly IAppConfiguration appConfiguration; private TopicClient topicClient; private Qu...
I'm beginning the long process of developing an Adventure Game/RPG and I was hoping to get some review on a resource system I'm coming up with. How it works is, a resource is generic to every resource in the world. Each resource will have a name, a random yield, and a random quality. So I've created an interface for ...
I am trying to find the best average score from below two dimensional array: String[][] scores = { { "Amit", "70" }, { "Arthit", "60" }, { "Peter", "60" }, { "Arthit", "100" } }; The output is: 80 (Arthit's score (60+100)/2) Till now I solved this problem with below approach, however I am looking for elegant solution ...
I was successfully able to write a small script using PySpark to retrieve and organize data from a large .xml file. Being new to using PySpark, I am wondering if there is any better way to write the following code: import pyspark from pyspark.sql import SparkSession from pyspark.sql.functions import monotonically_incre...
I have implemented a custom run length encoding algorithm that converts an m x n array into an p x (n+1) array. The extra column is to record counts. Probably easier to show through examples: encode = (array) => { // crude array equality function arrayEquals = (...arr) => { return arr[0].map(x => { retu...
I'd like to be able to better test application stability. Usually when you're doing this, you run the application and keep your fingers crossed that it won't crash when an error occurs (be it a missing file, no database connection or whatever service didn't work). The problem is that it's difficult to provoke everythin...
I was trying to see if data.table could speed up a gsub pattern matching function over a list. Data for reprex. It's a list of 3 data frames with some asterisks placed here and there. Each data frame is 6500 rows, 2 columns, and generally representative of my actual data. My data does have multiple columns per data fra...
Consider the following sorting algorithm: df <- data.frame(food_1 = c("APPLE 1534", "PEAR 2525", "BANANA 3045", "WATERMELON 5000"), food_2 = c("ORANGE 2035", "BROCCOLI 5000", "BLUEBERRY 2000", "TOMATO 3000"), stringsAsFactors = FALSE) # Sorting for (i in 1:nrow(df)){ foods <- sort(c...
I'm learning to code for fun, and just finished my first program. I don't know what to think about it since it's my first finished real code, but hey it works! I'm pretty sure that it can be written shorter or better than this. Right now it can only solve 1 problem at a time, but I'm going to make it so it can save the...
val y: Seq[Either[String, Int]] case class Response(value: String) val notFound = Response("Not Found") val found = Response("Found") val response: Response = y.lastOption .map(_.fold(_ => notFound, _ => found)) .getOrElse(notFound) I am getting a list of Eithers. I want to get the last Either in the lis...
Here is the old thread that I started out with. The code I've got now is vastly different thanks to those two. What I have now functions fairly well and looks pretty good. I've managed to work it back down to some decent speeds, but I'm still encountering long solve states. I am "fairly" certain that I have both my sol...
Handling abstract types in json.net can be sometimes challenging because it requires a very long and complex syntax like: "$type": "Namespace.Type, Assembly" It's not that difficult if you have simple classes but as soon as there is some generics involved it becomes tricky pretty quickly: "$type": "Namespace.Type`2...
I have programmed a card game in Python. How can I improve the code? There is a deck of cards. Each cards has a colour (red, black or yellow) and a number from 1-10. There are two players. Every round, each player takes one card from the top of the deck. Those cards are compared, and the winner of the round is assigned...
I have created a product landing page for a freeCodeCamp responsive web design project which requires me to create a "Product Landing Page". Requirements to keep in mind: User Story #1: My product landing page should have a header element with a corresponding id="header". User Story #2: I can see an image within the he...
I have a get route to show the data for a chat with another user. If an existing chat exists I want to return that, otherwise create a new chat and return it. /chat/user/{contra_user_id} Should my Service or my repository be adding chat members to the chat? Currently I have my service creating each member. class ChatS...
I'm kinda new to programming, and as a solution to an exercise, I made a program to find prime numbers in a range. It runs just right for small ranges of numbers, but for this exercise we are given a high range of nums, and it just takes much time to finish examining. Any suggestions how can I make it faster? #include ...
I'm working on a small open source project called CSV-simplified for a course I'm taking (Bloc), and I'm looking for some feedback and potential collaborators. I don't actually know an programmers, so I'm hoping someone here may be interested in helping out. The basic idea of CSV-simplified is a browser app capable of ...
This countdown timer is supposed to: be synced to the user's clock at every hour and half hour, will start a 25 minute countdown followed by a 5 minute break The code works but I question its efficiency. function startTime() { var today = new Date(); var minutes = today.getMinutes(); var seconds = today...
This question was originally posted on Stack Overflow. You can see the before and after there, but here's the after that I'd like to bring for review here. The goal of this script is to polyfill any browsers I'm supporting that don't natively have position: sticky. Example: I'm thinking about detecting IE11 and runnin...
I have recently started learning functional programming and Haskell. I have encountered this problem: Consider three two-dimensional points a, b, and c. If we look at the angle formed by the line segment from a to b and the line segment from b to c, it either turns left, turns right, or forms a straight line. Define a...
Example image: Code: #get height and width of image height, width = possible_barcode_img.shape[:2] #prepare list for rows barcode_rows = [] for i in range(height): # set variables and list for beginning of row white_bar_width = 0 black_bar_width = 0 barcode_row = [] for j in range(width): ...
Purpose I managed to get completely nerd-sniped earlier today by a question over on SO and decided to take a stab at adapting my numeric input wrapper for TextBoxes into one that would handle numeric date input in various different formats and automatically add the delimiters. I usually do VBA user input handling into ...
I just started to use classes in Python, so I don't know all concepts, rules and conventions about it. I made a little program of a machine gun, which simulates firing by user's action. Here it is: import random, pygame, sys class MachineGun(object): bullets = 200 def __init__(self): self._magazine = ...
I'm going through the K&R book (2nd edition, ANSI C ver.) and want to get the most from it. Note that, for the sake of exercise, I don't want to use techniques not introduced yet in the book and I'm compiling with the -ansi flag. K&R Exercise 1-16 Revise the main routine of the longest-line program so it will correctly...
I was curious as to how I'd be able to make this much clearer to read because from my perspective I understand what does what but how does it look to a third party? Also how are my object / method names doing? //Program that stores units into a vector and compares / prints them back to the user. #include "../../std_lib...
I have recently started coding in Java and I had to do this assignment in college. Develop a menu driven application called TestCarPartc that allows the user to add, remove and list Car objects. For this use an ArrayList of Car. What are the advantages of using an ArrayList over an array? Place the answer in a comme...
I am a beginner at coding Java and am having a tough time understanding what is wrong with this code. This is an assignment I had posted about earlier and I also went to a Java tutor at my school for help after having issues communicating with my actual teacher (I am an online student). She gave me 10%. I will include...
I have the following conditional flow and I'd like some comments about it: bool IsPositive(object sender) { if (!(sender is SymbolIcon symbolIcon)) { if (sender is ContentControl content && content.Content is SymbolIcon i) symbolIcon = i; else if (sender is Viewbox viewBox && viewBox.Child is SymbolIc...
This is a console application that generates the factorial of a given number. Is there any way I can improve my code ? int number = Convert.ToInt32(Console.ReadLine()); int digitFactorial = number; for (int counter = number - 1; counter > 0; counter--) { digitFactorial *= cou...
I am learning Racket and implemented a BST insert function (insert tree n) where the format for a BST node is (left-tree value right-tree). Example '((() 2 ()) 3 ()) is isomorphic to: (3) (2) () () () Therefore (insert '((() 2 ()) 3 ()) 4) yields ((() 2 ()) 3 (() 4 ())): (3) (2) (4) () () () (...