instruction
stringlengths
71
71.9k
I got a programming puzzle described as follows: Save Beta Rabbit Oh no! The mad Professor Boolean has trapped Beta Rabbit in an NxN grid of rooms. In the center of each room (except for the top left room) is a hungry zombie. In order to be freed, and to avoid being eaten, Beta Rabbit must move through this grid...
I was trying to fill a file with about ten million random characters (a-z,A-Z,' '). To my surprise the code is extremely slow. I inserted this print i to observe the progress. It was so slow that I just left the program running and went out. After about more than three hours it is still at five millions. How can I mak...
This is code for a Rock-Paper-Scissors game I made using some of the OOP concepts I learned in C#. I don't know if I am making the right choices but I am fairly confident. It would be great if I could receive guidance here. I chose to have a Player and Computer class inheriting from an abstract Participant class. Every...
I was in need of a method to dynamically generate a week range, so that the view reads something like "Week of May 16 - 22" and updates automatically. Here's the helper method I came up with, but I'm wondering if there's a more efficient way to have gone about this. Dashboards Helper: def week_range today = DateTime....
I am currently working on a Universal Windows Platform App. It involves using a flipView to display a certain number of pictures in the user's picture library e.g less than 100 to avoid performance overhead. The code is displayed below : // The constructor of my view model public PictureViewModel() { ...
I've created a class that implements customized addition, subtraction, etc. But for this class I'd like to have some additional parameters for these methods (__add__, ...). So my first thought was: A global dictionary that can be set or altered before I do the operations and internally it just accesses this dictionary ...
I coded this simple protocol but I'm sure that it can be better, this is the process: Reads incoming data Waits until payload size can be read Reads the full message Checks if there are mixed messages Reads incoming data again Code: private async void ReadPackets(StreamSocket socket, SocketInformation socketInformati...
An aisle is defined as two rows of six stalls each. A stall is adjacent to another if it is directly next to it or across from it. My method finds out how many stalls can be found in a chain from the stall currently being worked with that are available for use. For example, * is a stall that is already occupied, and...
I'm writing these pieces of code to parse expressions in the context of a dice rolling application for DnD. It's pretty much my first try using TypeScript and I'm not that good in Javascript. It is also the first time I write a syntax tree. It's been tested using the Jasmine framework. I'll split the question in two b...
I'm doing this HackerRank problem: Given \$N\$ integers, count the number of pairs of integers whose difference is \$K\$. So far, I've ended up with this code: def countPairs(ar, n, k): ar.sort() temp = list(ar) i = 0 j = n - 1 cnt = 0 while i < n: while abs(ar[i] - temp[j]) > k and j ...
I am tasked with creating a list with no duplicates of all String elements, in this case first names, of an ArrayList. The method is passed a threshold, and the method must store the first name if it has occurred at least the amount of the threshold. The restriction is that I am only allowed to use the List ADT. I have...
I am working on a large project that requires information about the monitor(s). Please don't be confused by the organization of the following structs. The design intent is to be cross-platform, so they don't contain any operating system-dependent types. Currently, I am working on the Windows implementation of the follo...
Problem Statement: Write a program that converts a number to a string, the contents of which depends on the number's prime factors. If the number contains 3 as a prime factor, output 'Pling'. If the number contains 5 as a prime factor, output 'Plang'. If the number contains 7 as a prime factor, output 'Plong'. If t...
Introduction: I'm creating a form using bootstrap and I have different input groups with the same structure and functionality. All of them have a '-' button on the left and a '+' button on the right of the input field and, when one of them is pressed, the input value has to change. Problem: As the buttons are inside a ...
I'm working on a game engine among other things in Java, and would like to know how to optimise my code, as it is ridiculously ugly and bloated. I'm terrible with operating the java.util.File and need my code to be reviewed by others. In essence, I have a folder hierarchy setup in the following manner: Custom folder w...
I have created a class to try, catch and retry N times. My class also supports retrying asynchronously. I'm wondering if there are better ways to implement this. I'm most concerned with the HandleException and RetryLoop methods, but also about the design of the class as a whole. TryRetry GitHub /// <summary> /// Class ...
//This program generates a maximum possible palindrome from of a string num 's', of length 'n', by switching only 'k' digits. import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner sc...
I've made this developer-tool for my own use. Perhaps for colleagues too. Currently I'm thinking about enhancing it. So that different data-types could be chosen. But before that I like it to be reviewed. Therefore: Any hints and suggestions concerning algorithm, design, user-interface, whatever welcomed. var text...
I use the following code that is working as expected and I want to get some feedback from the community how I can Improve it... The code does the following: Get Some request with specific action to run which is describe in JSON file e.g. URL is like aaa/bbb/invokeFn Find this invokeFn in the config.json and call to ...
This is a simple ToDoApp with a CLI that is made useful by adding persistence. A shout out to @Phrancis and @syb0rg for guiding this little project to where it is now. The structure is rather simple. The basic class is ToDoItem. It is stored in an implementation of the interface ToDoRepository - in InMemoryToDoReposito...
As tim suggested, some changes to the database was necessary. I have posed an improved version of this question at Get title from database based on member country. I have the following database: Each member may have multiple countries (1:n) mapped in table country2memb. It's even possible that one member gets the sam...
i've node app that having the main function server.js(entry point) Following is the server.js file code var childModule = require("./controller/childModule"); var server = http.createServer(app); var proxy= require('./controller/proxy'); var proc = require('./controller/runIntProcess'); var extLoader = require("./contr...
I asked this question before. However, I realized that I had to edit some of my code after I got good answers. Therefore, I'm asking a new question here. I have the following database: Each member may have multiple addresses (1:n) stored in table address. It's possible that one member has multiple addresses within on...
I am working on a program which manages a list, and must be able to insert new items, and delete ranges of items. I want the user to be able to specify the insertions and deletions in terms of the current state of the list, and not have to worry about how later operations will need an offset index in order to work on t...
The program consists of 3 files: demo.c, mylib.c and mylib.h. The code is heavily commented. demo.c: /*********************************************************************** * * This is a program that prompts the user for an input string using a * custom input function. * ******************************************...
This is a small program to calculate the CRC for an STM32 program image, compatible with the CRC on the STM32 hardware. It's a word-wise CRC, and the bin file is encoded as a series of 32 bit little endian words. This is my first serious attempt at Rust and I'm looking for general comments, as well as a few questions: ...
As homework I had to implement many sorting algorithms including radix sort in Java. The task is to sort doubles in the range [0-1) that are rounded to the 10th decimal point. I thought of 2 ways on doing radix sort, one using counting sort and another one using buckets. They both work but they are extremely slow compa...
My code works and does what it is supposed to. However it needs to be more efficient. Could anyone help me tidy this up and show me where I could perhaps not rely on large loops (which it does a lot and slows it down). import java.util.ArrayList; public class PigLatin { public String translate(String str) { fin...
The implementation below works, but I'm wondering if there's a modern C++ alternative. For example: Should I replace the raw new with a braced initializer? Should I replace the Node* with a shared_ptr? Let me know if you see any other things I could improve. I know I could also use a class, but I'd like to understand...
Most hangman implementations I have seen keep a list of characters the player has already guessed and compares them to the players current guess each time to see if they have already made the same guess. My implementation checks if the word was changed after replacing any matches. Is my implementation easier to under...
I've just finished work on my guessing game. I'm still fairly new to Python, so I'm looking for feedback and criticism on the code. def game(): import random #imports the module 'random' yes={"Yes","Y","yes","y"} #set 'yes' to these 4 strings no={"No","N","no","n"} #set 'no' to these 4 strings name=i...
I'm relatively new to Python 3, especially IO programming, writing a Blender add-on to import model data. The model data is available in a custom compression, and I originally wrote code in C# to decompress it in memory, porting it to Python 3. However, being a little unsure about the "optimal" usage of IO classes and ...
I've tried everything to make my program faster but with 250 nodes my code takes around 9 seconds to print the result, and with 5000 nodes it took around 260 seconds. Is there a way to make my program faster? I took the BFS function from here. The site(connections) should consist of three towns each of which is connec...
The post is follow up to my previous Typelist with extractor. The type_list and extraction feature code is identical to the accepted answer (from user2296177). The idea is to provide a type list with fundamental features that users could built something specialized upon that. List of features, by order of appearance in...
How can I optimize this? #include <iostream> using namespace std; bool isprime(long nur); void printAll(); long primes[10000000]; long primeCount = 0; int main() { long limit; cout << "Enter the limit "; cin >> limit; for (long nur=2; nur<= limit; nur++) { if (isprime(nur)==true) ...
I've tried looking some stuff up. I thought it was transposition first, but looking at this, that's not exactly it. I hacked this code together in about 3 hours, stopping frequently due to frustration and I'm pretty sure there's some bad practices in there, I'm just too glad right now I actually got it to work. If anyo...
Surprisingly, this question has no satisfactory answer. A safe usage of a LockCloseable would be like try (LockCloseable lockCloseable = LockCloseable.lock(lock)) { doSomethingUnderLock(); } // automatic release or using @lombok.Cleanup { @Cleanup LockCloseable lockCloseable = LockCloseable.lock(lock) doSo...
I have written a wrapper for my code that allows basic namespacing and I'd like some feedback on how it can be improved. It is designed so that a module can define it's namespace and get access to all of the parent namespaces. These are spread in reverse order across the arguments of the module (i.e. first.second.third...
I have implemented a metaclass in Python 3 that, apart from the usual instance constructor (i.e. __init__), enables you to define a class constructor (as a class method that I called __init_class__). The metaclass extends abc.ABCMeta so it supports abstract classes, i.e. the class constructor is not called if a class i...
I have written a simple wrapper for a 2D grid in JavaScript that allows me to resize the grid dynamically and I'd like to know if there's any way I can improve on my code. Here is the code itself: function Grid(width, height, defaultValue) { width = Math.max(0, width); height = Math.max(0, height); Object.define...
In an effort to keep all of the Google Maps Javascript API in it's own little world, I have created a googleMaps object that will contain all of the functions that directly make google maps webservice calls. This object will be imported once on every page. For now, it only has one function. if (googleMaps === undefin...
I am about to start a small/medium sized project. I am by no means a software architect. But I tend to question every move I make at times, since I want to do things correct. I found a way to implement a simple repository, and I wanted to know if this is a "correct" way of doing it. I came to this solution, since I kno...
Trying to figure out how to efficiently cache property calculations with dependency tracking to invalidate the cache. Here is the syntax I have at the moment (one Cache instance supports multiple object properties): class Multiplication { public int Arg1 { get; set; } public int Arg2 { get; set; } public in...
I think many here are familiar with the graph data structure. Not very long ago, I implemented as an exercise a supposedly simple Graph application that does some traversals. To note, the most complex operations in this class are those that exhaustively find Paths: findDirectPaths, findPathsWithMaximumDistance, and fin...
I am not very experienced in PHP OOP. Moreover, when MySQLi comes with PHP OOP, it makes me more confused about using it in the most efficient way. Connection class: <?php //connectionclass.php class connection{ public $conn; public $warn; public $err; function __construct(){ $this->connect(); } private function co...
This application is designed to query an active directory, and at the moment, performs only two tasks: Save a list of all users to a file. Save a list of all groups that all users are in to a file. I tried to implement a print all groups method, but ended up removing it. I believe I removed all references to it from ...
I am playing a bit with vanilla JavaScript and created a simple JavaScript calculator using eval(). Any suggestions for improvements? var keys = document.getElementsByClassName('number'), getTotal = document.getElementById('showTotal'), btnReset = document.getElementById('reset'), visor = document.getEleme...
background: I have a model called FileInfo, which represents a sftp file / windows dfs file. class FileInfo(object): def __init__(self, server_info, folder_path, file_name): self.server_info = server_info self.folder_path = folder_path self.file_name = file_name def get_file_full_path...
I have two collections that I want to retrieve from the database and associate with each other. My solution works, however I know it isn't the most elegant one. Do you have any suggestions on how to improve the algorithm? Classes: public class JobAnnouncement : IDbEntity { public int Id { get; set; } public Jo...
Note: Yes. It's big. I'm not expecting commensurately long/detailed answers (though if anyone wants to write one, you'll definitely be receiving a substantial bounty). This class is going to be used a lot in my VBA development so any reviews at all would be immensely helpful. Even if it's just a typo somewhere o...
Recently I used this pattern to create a list of properties, each property having a varying number of arguments. The properties list can be made at compile time, it does not need to change at runtime. I tried to code this in a way such that it was easy for me to edit to add in additional properties (i.e., easy to add ...
A few days ago I posted a little program that would check for vowels within a given word. I have rewritten this program, it can only find vowels in the English language still but, it will now tell you each vowel that is contained in your word, along with a count of how many vowels there are total, it's still not very e...
I was asked to provide a codebase for the following exercise. I have provided the requirement of the problem and also putting down the code of two main classes. Can you please review and provide your input on improvement and also point out any issue or general feedback? Java Service capable of posting GitHub events to ...
I have the following switch: switch (triggerTypeId) { case Dom.Survey.TriggerType.CandidateContract: list.Add(Dom.Survey.Rule.SendThisQuestion.Id); break; case Dom.Survey.TriggerType.CandidateContractEnd: list.Add(Dom.Survey.Rule.SendThisQuestion.Id); break; case Dom.Survey.TriggerType.CandidateHours:...
I use the the View below to get things started. I'm not interested in Marionette. This code is what is constructed when the application first loads. It in turn loads the composite view which is common to all loads. It also constructs other objects needed for the application. I'm looking for feedback on code structure...
I asked this question on Stackoverflow, and was told I might have better luck here. I'm new to c# and have created a basic file archiver. It works, and it does what it's suppose to do, but I think it's pretty slow. I added a simple benchmark in order to test the speed and ran it five times. 50.7120707 seconds 46.5686...
I'm picking up Go, and wrote this simple script to parse a two csv files (spending.csv and savings.csv) to plot savings rate graph. I would like to hear some generic comments on code readability, libraries I missed out on using, and Go-ness of the code I wrote. I also used global variable months which I am not very ha...
The task A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. This problem has been reviewed numerous times on this site, and many extraordinary clever solutio...
For some post-processing, I need to flatten a structure like this {'foo': { 'cat': {'name': 'Hodor', 'age': 7}, 'dog': {'name': 'Mordor', 'age': 5}}, 'bar': { 'rat': {'name': 'Izidor', 'age': 3}} } Each bottom entries will appear as a row on the output. The heading keys will appear each row, f...
I'm sure it's still not yet perfect and tips will be greatly appreciated! I just re-read the script and I realised I'm not handling exceptions! The script is unfinished but I'm looking for WIP (work in progress) feedback to shape the direction I continue. You can avoid commenting on the lack of exception handling. I'd ...
I've got a barebones C++ graph class implemented as an adjacency list. The graph consists of a vector of vertices. Each vertex has a vector of outgoing edges that store the destination vertex id. Vertex ids are just 'int's, incremented each time a new vertex is added to the graph. This code is mostly for practice as...
I was writing a program for my math class because my Professor asked me to. The problem is as follows: 300 people are arranged in 30 rows each of 10 people. The tallest of each row is chosen, and the shortest of each column. The problem is to prove whether the shortest of the taller people is taller, or the tallest of ...
I need some help to refactor the script. I have a script which matches the buy and sell trades based on FIFO order. The initial dataframe looks like this: AsxCode Order.Type Trade.Date Price Quantity match_status match_vol DMP Buy 17/08/2015 42.1179 105 DMP Sell ...
I'm looking for optimizations and/or improvements. The code's flagship method read takes qty,item in the form of an array of arrays. pluralizer.read([[2,'orange'],[3,'peach'],[5,'cherry']]) returns string 2 oranges, 3 peaches, and 5 cherries GitHub //Revealing Module Pattern (Public & Private) w Public Namespace 'p...
Codeforces #230B Question Whether a number has exactly three factors. (i.e. 1, itself and its square root, thus squares of primes) [Time limit is 2 sec, Memory 256 MB] Input Number of testcases, n (~105) then numbers (~1012) Output Yes or No Problem I first check if it is a perfect square, then check if it's root is pr...
I've come up with a simple graph traversal algorithm to calculate the aggregated cost of a directed graph or its subgraphs. Given a directed graph, the code visits all reachable nodes and sums up the cost related to the node paying attention to already visited nodes. The return value is the total cost of (sub)graph. F...
the below code does what it needs to do. However I would like to know if there are better (shorter) ways to express the below while maintaining the explicitness of showing the decision like with the usage of if. first a few definitions type Numbers = Array Number type Sizes = Tuple Int Int foreign import _dot :: Numbe...
I have the following script to create a parallax effect on the page using request animation frame, it runs well on Chrome, but on Safari is lagging, I think because I run too many calculations on each rAF. $('.parallax').each(function () { var section = $(this), elements = section.find('[data-parallax-rat...
After reading noobs, I'm interested in possible way to improve readability of the following short snippet. a struct pictdb_file is a small file system containing a metadata array and a file descriptor fpdb. the function allocates the resources, and forwards initialization to db_create_logic. How can I improve the re...
I am not sure if I am just having a brain lapse here or if there is a better way to do this: I am trying to only add one to count in the following scenarios: the bool excludezeros is set to false (count should be increased for iterations of the foreach) the bool excludezeros is set to true and studentScore is not equa...
I would like to call std::hypot with many arguments (not just 2 or 3). Mandatory requirements: fast run at compile time when possible Non-mandatory requirement: avoid overflow #include <cmath> #include <iostream> template <typename T> constexpr T sum2(const T v) { return v * v; } template<typename T1, typenam...
As I'm learning Ruby I wrote this little program to generate a "nice" number randomly (like 4747, 6969, etc.). As I'm currently breaking the "do not repeat yourself" rule, how would you refactor the following? def nice_numbers a = rand(9) b = rand(9) c = rand(9) d = rand(9) while a != c || b != d ...
I've been working on a game that I used to play as a kid. This game was disassembled then converted to C# by someone else and they hosted it on Github. I've forked it and started working on it some. One of the things I've been trying to convert over is how to read back the files that were saved during a save operation ...
I am having an app that has multiple activities and uses MQTT. I am using the Paho client in Gradle dependencies as follows: compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.0.3-SNAPSHOT' compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.3-SNAPSHOT' I would be using username and password to con...
I've drawn a Koch snowflake with Python 3. I'm new to the Python world and would appreciate all feedback on how to make the code more Pythonic as I'm not used to these idioms, styles and modules. All other feedback is of course also greatly appreciated. The snowflake is constantly redrawn in preparation for the future....
I am currently working with this code to automate some tasks for senior staff members that are not very adept in Excel. Wondering if VBA is simply not a very quick code or if my code is clunky and slow. For clarity, I would think with how simple this code is it could run in under a second or two. Maybe this is overzeal...
I'm writing a console application that will look through a directory and move any log files that have a date modified older than X days (configurable in the app.config file). The problem I'm having is with the Move method I wrote. It works, but I think there might be a better way to write this method and eliminate the ...
We want to refactor two methods that are exactly the same, except for one difference: one takes an org.hibernate.Criteria and the other org.hibernate.criterion.DetachedCriteria. These two do implement a mutual interface (org.hibernate.criterion.CriteriaSpecification), but this only contains some final static fields, an...
I'm a noobie in programming so I've made a simple hangman game in python and I'd like someone to tell me how I could improve the code. edit:How could I do it using classes? from sys import exit def makeGallow(gallow): for i in range(8): gallow.append([]) gallow[0].append(6 * '_') ga...
I have JSON with references to other parts in that JSON file. // the function I would like to be reviewed function referenceToObject(json, reference){ return (new Function( 'json', 'return json' + reference ))(json); } // json var example = { "target": "['first']['second']", "first": { ...
Overview The following is an attempt at a Rock-Paper-Scissors (etc) game that has its business logic encapsulated in a rules engine. For the purposes of this exercise, I kept all of the business logic (eg what-beats-what and the "verbs") in a JBoss Drools engine. This application doesn't have an "interface" per-se. It...
I am trying to create a small application that will help me extract data from Hadoop via hiveserver2 by simply writing it to CSV. At the moment, it takes about 40 seconds to pull 10,000 records from a hs2 table consisting of 500k rows with 203 columns. I would like to think that there is a faster, more efficient way of...
I have a SQLite database that only contains the holidays for 1 user. I have a new Trip object (newTrip) that has a StartDate(long unix time) and an EndDate(long unix time) and the trip Iso3Code(string) for the location. I need to retrieve from the database all existing Trips that can be merged with the newTrip. A trip ...
I try to work with a contiguous block of memory, to create an array (2D) whose SIZE is not known at compile time (before c99) so no variable-length arrays are involved here. I came up with the following: #include <stdio.h> #include <stdlib.h> int main(void){ unsigned int row, col,i, j, k; int l = 0; int *a...
This is a follow up with revised code, see the original question and subsequent answer in the following link (Copy, Paste And Format) This is a full version of all three "Macros" or subs within the workbook that I'm currently working with. I hope to use much of this as a reference in future automation to many other asp...
I just started teaching myself to code a few days ago using the Euler problems. I finished a variant of problem 3: print the prime factors of a number input by the user. I just want feedback and code cleaning from someone who knows better than I do to help me progress. import math #What is the largest prime factor of ...
This is a follow up to this question. I got some very good answers for my process speed, and wanted to go ahead and share what I've done with the program. The new updates of the program consist of the following: Put all the information handling into it's own class Changed the way the filename is created, much quicker ...
I wonder which of the two snippets is better? In the second one, I extracted two short subroutines. On the one hand, extraction clearly separate the two tasks On the other hand, it induces 6 more lines for function prototype The code is about a simple images database called pictdb_file. The first function contributes...
As root, run: #!/bin/sh if cat /etc/redhat-release | grep -q 'release 5'; then cp /etc/inittab /etc/inittab.install sed -i 's/ca::ctrlaltdel/#ca::ctrlaltdel/' /etc/inittab init q elif cat /etc/redhat-release | grep -q 'release 6'; then cat << EOF > /etc/init/control-alt-delete.conf exec false EOF elif cat /etc/...
So I have this code that for the most part, does what it needs to do, but I'm having trouble making it more concise and elegant. Codepen Intended functionality: If you click a trigger, it's corresponding element must display If you click another trigger, that trigger's element displays and the other closes If you cli...
How can the time complexity of the following code be improved (assuming it's \$O(N^2)\$)? What about style and patterns? This code is trying to find the minimum subarray size that adds up to given sum k. Elements should be adjacent. /** * Created by mona on 5/24/16. */ public class MinSubArray { public static vo...
I've been doing some reading and tutorials. As such I've contrived a node based project to apply what I've learned. I thought this was a good example as it had some conditional async calls and error handling. Any and all criticism of not following current JS best practices welcome. /** * mkLocalCfg function, * make...
I have written some simple code to detect cyclic dependencies for a module loading system and I'd like some feedback on how I can go about improving it. The code itself finds the first cycle in the dependency graph that starts at the provided node and returns a list of all of the nodes traversed along the way. Here's a...
Are there better methods for merge and sorting arrays of int and String in more efficient methods both time-complexity wise and code-pattern wise? I also wonder if I could have a generic method that could work for any kind of given type like <E>. I am preparing for coding interviews, so I prefer to see solutions that i...
I understand that a shell should be able to perform arithmetic expansion. My shell can do it: $ echo $((1+2*3+4*5)) 27 My solution uses the lemon parser where I used a calculator example from SO: https://stackoverflow.com/questions/34918631/use-lemon-parserlalr-generate-a-calulator-how-to-get-param-from-expressions My...
Somebody please verify this code. Is this efficient? please tell me modular way to accomplish this task. Updated I want to add show class to data-targetand remove show class from data-group Just like happening in an accordion. I wanted to know that this code is perfect for that scenario. I'm new here please let know...
I just encountered this question in codility but apparently this question has been asked in java already (here, here). Task description A zero-indexed array A consisting of \$N\$ different integers is given. The array contains integers in the range \$[1..(N + 1)]\$, which means that exactly one element is missing. You...
I have this following piece of code: @Component public class ManifestReader { private final ServletContext servletContext; private Properties p; @Autowired public ManifestReader(final ServletContext servletContext) { this.servletContext = servletContext; } public Properties getManifes...
I have a CLS_Comparison_Predicate which will take an input value, perform a logical comparison and return a Boolean. CLS_Compound_Predicate instead takes lists of predicates and an inputValue, and performs MatchAny() or MatchAll() operations on the predicate list. E.G. predicate_1 has >= 3 predicate_2 has = 5 Match...
I have implemented a dynamic array based stack. Can someone point out any pitfalls or things that can be done better? MyStack.h #ifndef MYSTACK_H #define MYSTACK_H #include <iostream> #include <stdexcept> template<class T> class MyStack { private: T* m_array; int m_count; int m_max_size; static ...