homework

compilation process in C++

I will be very grateful, if somebody can actually explain what exactly my compiler does when I press button BUILD, and compiler begins to compile all my .h and .cpp files how exactly this process is going on(what do I have inside object file?), why do I ask such question? I'm trying to understand what does it mean "minimize compilation d...

linked list memory diagram

struct letter { char ch; struct letter *ptr_next; } *ptr_first,*ptr_this; //ptr this contains the address of the first node and ptr this contains the address of last node added. A word chair has to be inserted in the linked list such that C goes into the first node,h in the second and so on.. The attached picture is the memory diagram ...

Signed right shift = strange result?

I was helping someone with their homework and ran into this strange issue. The problem is to write a function that reverses the order of bytes of a signed integer(That's how the function was specified anyway), and this is the solution I came up with: int reverse(int x) { int reversed = 0; reversed = (x & (0xFF << 24)) >> 24; ...

why my template is already defined?

hey, i'm trying to compile my work and i'm getting this error : function template has already been defined and it's written about all my template functions. any idea what can cause such thing? ...

what is synchronization of thread in java?

what is synchronization of thread in java? give any example on it in detail ...

Scheme Understanding

I am supposed to write a scheme function (digit-count n) that accepts a positive integer n and evaluates to the number of digits of n that are 6, 4, or 9. I am having trouble understanding what exactly I am supposed to do, I am confused about the "digits of n that are 6, 4 or 9", what does this mean? ...

c++ constructors

suppose that MyClass has methods with the following prototypes: void method1(MyClass & object1);  MyClass * method 7();  What will be this method destructor, constructor, copy constructor, overloaded= or default constructor? This is one of question in my homework. I think the first one is default constructor and second one is copy...

How to cut off leading digits? C++

How can I cut off the leading digits of a number in order to only display the last two digits, without using the library. For example: 1923 to 23 2001 to 01 1234 to 34 123 to 23 with only #include <iomanip> #include <iostream> Thanks! ...

Binary Search to Compute Square root (Java)

I need help writing a program that uses binary search to recursively compute a square root (rounded down to the nearest integer) of an input non-negative integer. This is what I have so far: import java.util.Scanner; public class Sqrt { public static void main(String[] args) { Scanner console = new Scanner(System.in); Sys...

super() in Java

Is super() used to call the parent constructor? Please explain super(). ...

c# extracting words

Hi, i have following piece of code with me iam spliting the words using only one space and the output is output: when ambition ends happiness begins But i want split the words after two spaces i mean my output should be like this: when ambition ends happiness begins string vj = "when ambiton ends happiness begins"; List<string>...

How to describe a MATLAB function using mathematical notation?

Basically I have created two MATLAB functions which involve some basic signal processing and I need to describe how these functions work in a written report. It specifically requires me to describe the algorithms using mathematical notation. Maths really isn't my strong point at all, in fact I'm quite surprised I've even been able to de...

Java Bucket Sort of Objects

I am asked to write my own version of Bucket Sort for Sorting an array of objects. My plan is to write a simple Entry class and another class with a main method and try to manipulate an array of lists. This is what I have so far, I just need some help putting it all together because I'm not very experienced with coding but I know what I ...

compiling problem

when is calling the function i'm getting error: " H:\workspace\HW5\HW5\Manager.obj H:\workspace\HW5\HW5\Manager.obj> Error 22 error LNK2019: unresolved external symbol "public: void __thiscall Shalishut::Task8_MoveVehicleFromBaseToBase(class Military *,char const *,char *,char *)" (?Task8_MoveVehicleFromBaseToBase@Shalishut...

Difficulties when attempting to create the Cartesian product of a pointer to char pointer

As input I have a pointer to char pointer containing: {"ab", "cd"} As output I need to create the following Cartesian product: {"abab", "abcd", "cdab", "cdcd"} I created a function that receives "ab, cd" and a pointer to char pointer that is meant to hold the resulting set. Although everything seems to be working fine inside the fu...

C get mode from list of integers

I need to write a program to find the mode. Or the most occurrence of an integer or integers. So, 1,2,3,4,1,10,4,23,12,4,1 would have mode of 1 and 4. I'm not really sure what kind of algorithm i should use. I'm having a hard time trying to think of something that would work. I was thinking of a frequency table of some sort maybe whe...

Generics in static factory methods? (Java)

I have an assignment that is requiring me to use the factory pattern for implementing an immutable data structure, but the problem is that the abstract class is generic, and having static methods make references to generic types is giving me problems. My assignment is requiring me to use static methods so I'm starting to panic. Any hel...

C++ Huffman Tree and Pointers

I am creating a Huffman Tree and to do so I started with making a Min Heap. The heap is set up and works sorting the values by frequency in the document but my problem comes when I try to start creating the tree. I am popping the top two items off the heap and putting a node above them and reinserting into the heap. The heap is array ...

How to find the min and max of a set of numbers in C without loops?

Lets say I have 10 numbers (doubles) and I have to find the smallest number and the biggest number without using loops, how would I do so? ...

Programming Logic: How to Check for Neighbors in a Grid?

Hi, I'm having a lot of trouble trying to think of a logical way to check for neighbors in a "grid"-based programming project for class. The main problem I'm having is thinking of a way to effectively check whether its on the sides so that I don't get an index out of bounds error. EDIT: I forgot to mention that I'm using a 2-dimension...