homework

Operator Overloading working but giving stack overflow and crashing in C++

I wrote this Node class and = operator overload function and this is the only way I could get it to compile and run but it just overflows and bomb my program. Can someone please fix it so it works. I don't have a lot of experience with overloading operator in C++. I just want to set a Node object equal to another Node object. Thanks in a...

how to define a class for stock using c++

how to define a "class" for "stock" using c++ language? The class should include the method of "meanvalue" and "variance", meanwhile it should also contain "trading volume" and some historical data. Thank you very much. ...

Substring recursive algorithm not working

I'm a programming student in my first C++ class, and recently we were encouraged to write a simple recursive function to find the first occurrence of a substring in a given string. If found, it returns the index. If the substring is not found, the index_of() function should return -1. We are encouraged to use a helper function that ta...

Creating a singly linked list in C

I'm trying to create a singly linked list from an input text file for an assignment. I'm trying to do it a little bit at a time so I know my code is not complete. I tried creating the head pointer and just printing out its value and I can't even get that to work, but I'm not sure why. I included the struct, my create list, and print l...

in Haskell how do you match against the type 'Either a b' ?

I have an interesting problem, well at least to me and I can't seem to figure out how to resolve it, so i'm hoping you can help. instance (Finite a, Finite b) => Finite (Either a b) where elems = combineLists [Left x | x <- elems] [Right x | x <-elems] size ??? = (size a) + (size b) I'm working on an assignment for a class a...

Single linked lists in C

I'm basically trying to create a linked list from a text file and add a new member every time the words are different, and increment the count if the words are the same (hw assignment). I thought I did it correctly, but it seems to add a member no matter what. I'm wondering if I'm traversing the list incorrectly while I search? Here i...

Get input text without scanner

Hi! I work on a school project and I am now wondering if it is possible to get text from JTextField with get? // Textrutor JTextField textTitel = new JTextField(null, 20); textTitel.setToolTipText("ex. Flickan som lekte med elden"); JTextField textSort = new JTextField(null, 10); textSort.setToolTipText...

Running a particular c file in linux

Hi, i am very new to unix/linux/c which i guess is why i am in this predicament. Anyway, i have just completed a c programme assignmnet and am trying to run it from linux terminal. So far i can create the main programme by navigating to the folder running gcc myFile.c then doing .a/.out this then runs my programme from the terminal wi...

Speed comparison between DRAM, HDD, and flash memory

The question: Assume that cache memory is ten times faster than DRAM memory, that DRAM is 100,000 times faster than magnetic disk, and that flash memory is 1,000 times faster than disk. If it takes 2 microseconds while reading from cache memory, how long does it take to read the same file from DRAM, disk, and flash memory? Does th...

What is business object and what are the softwares available to for working with business objects?

What is business object? In a school management application, what is said to be an business object? Is there any software packages available to create a business objects ...

Print the contents of the super block.

Hi, I'm told to write a program in 'C' to print the contents of the 'super block'. Can anybody tell me how to read the contents of the super block. Which system call can be used to do so? Thanks. ...

String statements

Talking about strings in C++, what is the difference between the following statements: s1=s2 and strcpy (s1, s2)? Supposing that s1 and s2 are (original version: type 'char', as revised) type char *. ...

How can I write a Java program to draw a box, an oval, and an arrow?

How can I write a Java program to draw a box, an oval, and an arrow? ...

Prolog: Recognize a^n b^(n+1) language for n >= 1

I understand that I need to figure out my own homework, but seeing that noone in the class can figure it out, I need some help. Write a Prolog program such that p(X) is true if X is a list consisting of n a's followed by n+1 b's, for any n >= 1. ...

Red-Black Tree Deleting Problem C#

Hey, I am trying to implement a red-black tree in C#. I already created an object called sRbTreeNode which has a String key, Color, Left, Right and Parent properties. I successfully managed implementing the methods Insert, InsertFixUp, LeftRotate, RightRotate, Delete, and now im having trouble with the method DeleteFixUp. DeleteFixUp i...

First-Occurrence Parallel String Matching Algorithm

To be up front, this is homework. That being said, it's extremely open ended and we've had almost zero guidance as to how to even begin thinking about this problem (or parallel algorithms in general). I'd like pointers in the right direction and not a full solution. Any reading that could help would be excellent as well. I'm working on ...

MIPS load word syntax

If I want to load a value from a memory which base address is at $a0 and off set $t2, why can't I do the following: lw $s2, $a1($t2) so what is the equivalent of the expression above? ...

[Javascript] How to iterate through multiple dropdown lists and access their option values

I'm writing the code for a basic GPA calculator. Basically, it's a 3-column-table, two text areas for the course name/credit hours and a dropdown list that contains letter grades (A+, C, B-) and their corresponding point values as the option value, like this <td><select name="letterGrades"> <option value="0.7">A+</option>> <option value...

What data structure using O(n) storage with O(log n) query time should I use for Range Minimum Queries?

I'm stumped by the following homework question for an algorithms class: Suppose that we are given a sequence of n values x1, x2 ... xn, and seek to quickly answer repeated queries of the form: given i and j, find the smallest value in xi... xj Design a data structure that uses O(n) space and answers queries in O(log n)...

Implementing Loops from Pseudocode

Hi everyone, I was wondering if anyone could suggest to me how to implement this loop in the following pseudocode: 8: loop 9: while f[0] = 0 do 10: for i = 1 to N do 11: f[i ¡ 1] = f[i] 12: c[N + 1 - i] = c[N - i] 13: end for 14: f[N] = 0 15: c[0] = 0 16: k = k + 1 17: end while 18: if deg(f) = 0 then 19: go...